[WIP] update config
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Gregory Trullemans 2021-12-22 12:26:12 +01:00
parent 60a5708709
commit cf3e6569e1
4 changed files with 7 additions and 6 deletions

View File

@ -137,8 +137,8 @@ STATIC_ROOT = BASE_DIR / 'staticfiles'
# Media root/url
MEDIA_URL = "/media/gymnast/"
MEDIA_ROOT = os.path.join(BASE_DIR, "/media/gymnast")
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

View File

@ -8,7 +8,7 @@
<h4 class="">{% if gymnast_id %}Edit{% else %}Add{% endif %} Gymnast</h4>
</div>
<div class="card-body">
<form action="{% if gymnast_id %}{% url 'gymnast_update' gymnast_id %}{% else %}{% url 'gymnast_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
<form action="{% if gymnast_id %}{% url 'gymnast_update' gymnast_id %}{% else %}{% url 'gymnast_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire" enctype="multipart/form-data">
{% csrf_token %}
<div class="form-group row {% if form.last_name.errors %}has-error has-feedback{% endif %}">
<label for="id_last_name" class="col-4 col-sm-2 col-md-3 col-lg-3 col-xl-3 col-form-label">Names*</label>

View File

@ -34,7 +34,7 @@ class Gymnast(Markdownizable):
verbose_name="# Training by week"
)
hours_by_week = models.PositiveSmallIntegerField(verbose_name="# Hours by week")
picture = models.ImageField(upload_to="media/gymnast", null=True, blank=True)
picture = models.ImageField(upload_to="gymnast", null=True, blank=True)
def __str__(self):
return u"%s, %s" % (self.last_name, self.first_name)

View File

@ -342,10 +342,11 @@ def gymnast_create_or_update(request, gymnast_id=None):
data = {}
if request.method == "POST":
gymnast_form = GymnastForm(request.POST, instance=gymnast)
gymnast_form = GymnastForm(request.POST, request.FILES, instance=gymnast)
print(gymnast_form)
if gymnast_form.is_valid():
if gymnast_form.is_valid():
# handle_uploaded_file(request.FILES['file'])
gymnast = gymnast_form.save()
return HttpResponseRedirect("/gymnast/details/" + str(gymnast.id))
else: