diff --git a/digitalglarus/migrations/0021_auto_20161017_1958.py b/digitalglarus/migrations/0021_auto_20161017_1958.py new file mode 100644 index 00000000..69b44dde --- /dev/null +++ b/digitalglarus/migrations/0021_auto_20161017_1958.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-10-17 19:58 +from __future__ import unicode_literals + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('digitalglarus', '0020_auto_20161013_0253'), + ] + + operations = [ + migrations.AddField( + model_name='membership', + name='end_date', + field=models.DateField(default=datetime.datetime(2016, 10, 17, 19, 58, 0, 209303, tzinfo=utc)), + preserve_default=False, + ), + migrations.AddField( + model_name='membership', + name='start_date', + field=models.DateField(default=datetime.datetime(2016, 10, 17, 19, 58, 7, 361473, tzinfo=utc)), + preserve_default=False, + ), + migrations.AddField( + model_name='membershiporder', + name='end_date', + field=models.DateField(default=datetime.datetime(2016, 10, 17, 19, 58, 15, 657240, tzinfo=utc)), + preserve_default=False, + ), + migrations.AddField( + model_name='membershiporder', + name='start_date', + field=models.DateField(default=datetime.datetime(2016, 10, 17, 19, 58, 16, 897120, tzinfo=utc)), + preserve_default=False, + ), + ] diff --git a/digitalglarus/models.py b/digitalglarus/models.py index 7ed0f53a..c809a8b5 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -62,6 +62,13 @@ class MembershipType(models.Model): class Membership(models.Model): type = models.ForeignKey(MembershipType) active = models.BooleanField(default=True) + start_date = models.DateField() + end_date = models.DateField() + + @classmethod + def get_by_user(cls, user): + return cls.objects.\ + filter(membershiporder__customer__user=user).last() @classmethod def create(cls, data): @@ -79,6 +86,11 @@ class Membership(models.Model): return cls.objects.filter(has_order_past_month | has_order_current_month).\ filter(active_membership).exists() + def update_dates(self, start_date, end_date): + self.start_date = start_date + self.end_date = end_date + self.save() + def deactivate(self): self.active = False self.save() @@ -86,17 +98,19 @@ class Membership(models.Model): class MembershipOrder(Ordereable, models.Model): membership = models.ForeignKey(Membership) + start_date = models.DateField() + end_date = models.DateField() @classmethod def current_membership(cls, user): - last_payment = cls.objects.\ + last_membership_payment = cls.objects.\ filter(customer__user=user).last() - start_date = last_payment.created_at - _, days_in_month = calendar.monthrange(start_date.year, - start_date.month) - start_date.replace(day=1) - end_date = start_date + timedelta(days=days_in_month) - return start_date, end_date + # start_date = last_payment.created_at + # _, days_in_month = calendar.monthrange(start_date.year, + # start_date.month) + # start_date.replace(day=1) + # end_date = start_date + timedelta(days=days_in_month) + return last_membership_payment.start_date, last_membership_payment.end_date def first_membership_range_date(self): start_date = self.created_at diff --git a/digitalglarus/static/digitalglarus/css/agency.css b/digitalglarus/static/digitalglarus/css/agency.css index 39289c6e..67154295 100755 --- a/digitalglarus/static/digitalglarus/css/agency.css +++ b/digitalglarus/static/digitalglarus/css/agency.css @@ -1172,11 +1172,11 @@ footer { } .map-caption{ - text-transform: none; + text-transform:uppercase; + font-size: 13px; font-family:"Montserrat","Helvetica Neue",Helvetica, Arial,sans-serif; font-weight: 400; color: #ffffff; - font-size: 14px; letter-spacing: 1px; text-align:center; } diff --git a/digitalglarus/static/digitalglarus/js/utils.js b/digitalglarus/static/digitalglarus/js/utils.js index d780fc25..e824dafc 100644 --- a/digitalglarus/static/digitalglarus/js/utils.js +++ b/digitalglarus/static/digitalglarus/js/utils.js @@ -18,4 +18,6 @@ $( document ).ready(function() { }); + + }); \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/booking_orders_detail.html b/digitalglarus/templates/digitalglarus/booking_orders_detail.html index f3d7b049..006c6568 100644 --- a/digitalglarus/templates/digitalglarus/booking_orders_detail.html +++ b/digitalglarus/templates/digitalglarus/booking_orders_detail.html @@ -55,8 +55,13 @@
+ View my bookings Go to my page +
++ Change dates +
- Your membership wouldn't be automatically renewed each month. + Your membership wouldn't be automatically renewed each month. Go back