From b5037329dded582a9f3572873df2066e3e92e1f3 Mon Sep 17 00:00:00 2001 From: Qwann Date: Sat, 11 Feb 2017 20:36:16 +0100 Subject: [PATCH] small fixes + migration enable admin interface for bds --- bds/admin.py | 3 ++- bds/models.py | 7 ++++--- cof/forms.py | 2 +- .../0010_remove_cofprofile_is_cof.py | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 cof/migrations/0010_remove_cofprofile_is_cof.py diff --git a/bds/admin.py b/bds/admin.py index 8c38f3f3..a5204b86 100644 --- a/bds/admin.py +++ b/bds/admin.py @@ -1,3 +1,4 @@ from django.contrib import admin +from .models import BdsProfile -# Register your models here. +admin.site.register(BdsProfile) diff --git a/bds/models.py b/bds/models.py index 783bc078..ecfbb3db 100644 --- a/bds/models.py +++ b/bds/models.py @@ -1,10 +1,11 @@ import os.path -from datetime import datetime +from django.utils import timezone from django.db import models from gestion.models import Profile + class BdsProfile(models.Model): profile = models.OneToOneField(Profile, related_name='bds', @@ -12,8 +13,8 @@ class BdsProfile(models.Model): def issue_file_name(sportif, filename): fn, extension = os.path.splitext(filename) - year = str(datetime.now().year) - return "certifs/" + sportif.__str__() + '-' + year + extension + year = timezone.now().year + return "certifs/{!s}-{:d}{:s}".format(sportif, year, extension) COTIZ_DURATION_CHOICES = ( ('ANN', 'Année'), diff --git a/cof/forms.py b/cof/forms.py index a1ae7e1f..719719a9 100644 --- a/cof/forms.py +++ b/cof/forms.py @@ -222,7 +222,7 @@ class RegistrationCofProfileForm(forms.ModelForm): class Meta: model = CofProfile fields = [ - "num", "type_cotiz", "is_cof", "is_buro", + "num", "type_cotiz", "is_buro", "mailing", "mailing_bda", "mailing_bda_revente", ] diff --git a/cof/migrations/0010_remove_cofprofile_is_cof.py b/cof/migrations/0010_remove_cofprofile_is_cof.py new file mode 100644 index 00000000..13bbc2ec --- /dev/null +++ b/cof/migrations/0010_remove_cofprofile_is_cof.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cof', '0009_generic_profiles'), + ] + + operations = [ + migrations.RemoveField( + model_name='cofprofile', + name='is_cof', + ), + ]