diff --git a/kfet/migrations/0053_created_at.py b/kfet/migrations/0053_created_at.py new file mode 100644 index 00000000..a868de33 --- /dev/null +++ b/kfet/migrations/0053_created_at.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('kfet', '0052_category_addcost'), + ] + + operations = [ + migrations.AlterField( + model_name='account', + name='created_at', + field=models.DateTimeField(default=django.utils.timezone.now), + ), + ] diff --git a/kfet/models.py b/kfet/models.py index cb8c324b..2ad1c091 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -41,7 +41,7 @@ class Account(models.Model): max_digits = 6, decimal_places = 2, default = 0) is_frozen = models.BooleanField("est gelé", default = False) - created_at = models.DateTimeField(auto_now_add = True, null = True) + created_at = models.DateTimeField(default=timezone.now) # Optional PROMO_CHOICES = [(r,r) for r in range(1980, date.today().year+1)] promo = models.IntegerField( diff --git a/kfet/templates/kfet/home.html b/kfet/templates/kfet/home.html index 96d28755..687c8573 100644 --- a/kfet/templates/kfet/home.html +++ b/kfet/templates/kfet/home.html @@ -20,40 +20,42 @@

Carte

-
-
-
-

Pressions du moment

-
    - {% for article in pressions %} -
  • -
    - {{ article.name }} - {{ article.price | ukf:False}} UKF -
  • - {% endfor %} -
-
- {% for article in articles %} - {% ifchanged article.category %} - {% if not forloop.first %} - -
- {% endif %} -
-

{{ article.category.name }}

-
    - {% endifchanged %} -
  • -
    - {{ article.name }} - {{ article.price | ukf:False}} UKF -
  • - {% if foorloop.last %} -
-
- {% endif %} +
+
+
+ {% if pressions %} +

Pressions du moment

+
    + {% for article in pressions %} +
  • +
    + {{ article.name }} + {{ article.price | ukf:False}} UKF +
  • {% endfor %} +
+ {% endif %} +
+ {% for article in articles %} + {% ifchanged article.category %} + {% if not forloop.first %} + +
+ {% endif %} +
+

{{ article.category.name }}

+
    + {% endifchanged %} +
  • +
    + {{ article.name }} + {{ article.price | ukf:False}} UKF +
  • + {% if forloop.last %} +
+
+ {% endif %} + {% endfor %}
diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index c9ee82ee..f271a306 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -839,7 +839,7 @@ $(document).ready(function() { var reduc_divisor = 1; if (account_data['is_cof']) reduc_divisor = 1 + settings['subvention_cof'] / 100; - return amount_euro / reduc_divisor; + return (amount_euro / reduc_divisor).toFixed(2); } function addPurchase(id, nb) { @@ -853,7 +853,7 @@ $(document).ready(function() { } }); if (!existing) { - var amount_euro = amountEuroPurchase(id, nb).toFixed(2); + var amount_euro = amountEuroPurchase(id, nb); var index = addPurchaseToFormset(article_data[1], nb, amount_euro); article_basket_html = $(item_basket_default_html); article_basket_html