diff --git a/cotisations/__pycache__/admin.cpython-34.pyc b/cotisations/__pycache__/admin.cpython-34.pyc index 0e4e2221..a11e9707 100644 Binary files a/cotisations/__pycache__/admin.cpython-34.pyc and b/cotisations/__pycache__/admin.cpython-34.pyc differ diff --git a/cotisations/__pycache__/models.cpython-34.pyc b/cotisations/__pycache__/models.cpython-34.pyc index 30b89c47..faed6fa7 100644 Binary files a/cotisations/__pycache__/models.cpython-34.pyc and b/cotisations/__pycache__/models.cpython-34.pyc differ diff --git a/cotisations/__pycache__/views.cpython-34.pyc b/cotisations/__pycache__/views.cpython-34.pyc index fa02e8e8..2a66acfd 100644 Binary files a/cotisations/__pycache__/views.cpython-34.pyc and b/cotisations/__pycache__/views.cpython-34.pyc differ diff --git a/cotisations/admin.py b/cotisations/admin.py index 8c38f3f3..a26ed35c 100644 --- a/cotisations/admin.py +++ b/cotisations/admin.py @@ -1,3 +1,20 @@ from django.contrib import admin -# Register your models here. +from .models import Facture, Article, Banque, Paiement + +class FactureAdmin(admin.ModelAdmin): + list_display = ('user','paiement','name', 'number', 'date') + +class ArticleAdmin(admin.ModelAdmin): + list_display = ('name','prix') + +class BanqueAdmin(admin.ModelAdmin): + list_display = ('name',) + +class PaiementAdmin(admin.ModelAdmin): + list_display = ('moyen',) + +admin.site.register(Facture, FactureAdmin) +admin.site.register(Article, ArticleAdmin) +admin.site.register(Banque, BanqueAdmin) +admin.site.register(Paiement, PaiementAdmin) diff --git a/cotisations/migrations/0002_remove_facture_article.py b/cotisations/migrations/0002_remove_facture_article.py new file mode 100644 index 00000000..a769e54e --- /dev/null +++ b/cotisations/migrations/0002_remove_facture_article.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cotisations', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='facture', + name='article', + ), + ] diff --git a/cotisations/migrations/0003_auto_20160702_1448.py b/cotisations/migrations/0003_auto_20160702_1448.py new file mode 100644 index 00000000..0dd211a4 --- /dev/null +++ b/cotisations/migrations/0003_auto_20160702_1448.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('cotisations', '0002_remove_facture_article'), + ] + + operations = [ + migrations.AlterField( + model_name='facture', + name='banque', + field=models.ForeignKey(blank=True, to='cotisations.Banque', on_delete=django.db.models.deletion.PROTECT, null=True), + ), + ] diff --git a/cotisations/migrations/0004_auto_20160702_1528.py b/cotisations/migrations/0004_auto_20160702_1528.py new file mode 100644 index 00000000..0a7f7322 --- /dev/null +++ b/cotisations/migrations/0004_auto_20160702_1528.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cotisations', '0003_auto_20160702_1448'), + ] + + operations = [ + migrations.AlterField( + model_name='facture', + name='name', + field=models.CharField(null=True, max_length=255), + ), + migrations.AlterField( + model_name='facture', + name='prix', + field=models.DecimalField(max_digits=5, null=True, decimal_places=2), + ), + ] diff --git a/cotisations/migrations/0005_auto_20160702_1532.py b/cotisations/migrations/0005_auto_20160702_1532.py new file mode 100644 index 00000000..355c5c69 --- /dev/null +++ b/cotisations/migrations/0005_auto_20160702_1532.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cotisations', '0004_auto_20160702_1528'), + ] + + operations = [ + migrations.AlterField( + model_name='facture', + name='cheque', + field=models.CharField(max_length=255, blank=True), + ), + ] diff --git a/cotisations/migrations/0006_auto_20160702_1534.py b/cotisations/migrations/0006_auto_20160702_1534.py new file mode 100644 index 00000000..aede867d --- /dev/null +++ b/cotisations/migrations/0006_auto_20160702_1534.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cotisations', '0005_auto_20160702_1532'), + ] + + operations = [ + migrations.AlterField( + model_name='facture', + name='name', + field=models.CharField(null=True, default='plop', max_length=255), + ), + migrations.AlterField( + model_name='facture', + name='prix', + field=models.DecimalField(null=True, decimal_places=2, default=1, max_digits=5), + ), + ] diff --git a/cotisations/migrations/0007_auto_20160702_1543.py b/cotisations/migrations/0007_auto_20160702_1543.py new file mode 100644 index 00000000..e048bbb6 --- /dev/null +++ b/cotisations/migrations/0007_auto_20160702_1543.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cotisations', '0006_auto_20160702_1534'), + ] + + operations = [ + migrations.AlterField( + model_name='facture', + name='name', + field=models.CharField(default='plop', max_length=255), + preserve_default=False, + ), + migrations.AlterField( + model_name='facture', + name='prix', + field=models.DecimalField(default=1, max_digits=5, decimal_places=2), + preserve_default=False, + ), + ] diff --git a/cotisations/migrations/__pycache__/0002_remove_facture_article.cpython-34.pyc b/cotisations/migrations/__pycache__/0002_remove_facture_article.cpython-34.pyc new file mode 100644 index 00000000..2c1fa056 Binary files /dev/null and b/cotisations/migrations/__pycache__/0002_remove_facture_article.cpython-34.pyc differ diff --git a/cotisations/migrations/__pycache__/0003_auto_20160702_1448.cpython-34.pyc b/cotisations/migrations/__pycache__/0003_auto_20160702_1448.cpython-34.pyc new file mode 100644 index 00000000..3d9a42d7 Binary files /dev/null and b/cotisations/migrations/__pycache__/0003_auto_20160702_1448.cpython-34.pyc differ diff --git a/cotisations/migrations/__pycache__/0004_auto_20160702_1528.cpython-34.pyc b/cotisations/migrations/__pycache__/0004_auto_20160702_1528.cpython-34.pyc new file mode 100644 index 00000000..834c06e4 Binary files /dev/null and b/cotisations/migrations/__pycache__/0004_auto_20160702_1528.cpython-34.pyc differ diff --git a/cotisations/migrations/__pycache__/0005_auto_20160702_1532.cpython-34.pyc b/cotisations/migrations/__pycache__/0005_auto_20160702_1532.cpython-34.pyc new file mode 100644 index 00000000..372205d6 Binary files /dev/null and b/cotisations/migrations/__pycache__/0005_auto_20160702_1532.cpython-34.pyc differ diff --git a/cotisations/migrations/__pycache__/0006_auto_20160702_1534.cpython-34.pyc b/cotisations/migrations/__pycache__/0006_auto_20160702_1534.cpython-34.pyc new file mode 100644 index 00000000..b7a0bdad Binary files /dev/null and b/cotisations/migrations/__pycache__/0006_auto_20160702_1534.cpython-34.pyc differ diff --git a/cotisations/migrations/__pycache__/0007_auto_20160702_1543.cpython-34.pyc b/cotisations/migrations/__pycache__/0007_auto_20160702_1543.cpython-34.pyc new file mode 100644 index 00000000..5ba122c9 Binary files /dev/null and b/cotisations/migrations/__pycache__/0007_auto_20160702_1543.cpython-34.pyc differ diff --git a/cotisations/models.py b/cotisations/models.py index 170cdd3a..206bdb1a 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -6,17 +6,16 @@ from users.models import User class Facture(models.Model): user = models.ForeignKey('users.User', on_delete=models.PROTECT) - article = models.ForeignKey('Article', on_delete=models.PROTECT) paiement = models.ForeignKey('Paiement', on_delete=models.PROTECT) - banque = models.ForeignKey('Banque', on_delete=models.PROTECT) - cheque = models.CharField(max_length=255) + banque = models.ForeignKey('Banque', on_delete=models.PROTECT, blank=True, null=True) + cheque = models.CharField(max_length=255, blank=True) number = models.IntegerField() date = models.DateTimeField(auto_now_add=True) name = models.CharField(max_length=255) prix = models.DecimalField(max_digits=5, decimal_places=2) def __str__(self): - return str(self.name) + ' ' + str(self.article) + return str(self.name) class Article(models.Model): name = models.CharField(max_length=255) @@ -42,7 +41,6 @@ class NewFactureForm(ModelForm): def __init__(self, *args, **kwargs): super(NewFactureForm, self).__init__(*args, **kwargs) - self.fields['user'].label = 'Adherent' self.fields['number'].label = 'Quantité' self.fields['cheque'].required = False self.fields['banque'].required = False @@ -50,7 +48,7 @@ class NewFactureForm(ModelForm): class Meta: model = Facture - exclude = ['name', 'prix'] + exclude = ['user', 'prix', 'name'] class EditFactureForm(ModelForm): def __init__(self, *args, **kwargs): @@ -65,4 +63,4 @@ class EditFactureForm(ModelForm): class Meta: model = Facture - exclude = ['user'] + fields = '__all__' diff --git a/cotisations/templates/cotisations/facture.html b/cotisations/templates/cotisations/facture.html index 8b2b9b58..dd3b917b 100644 --- a/cotisations/templates/cotisations/facture.html +++ b/cotisations/templates/cotisations/facture.html @@ -4,7 +4,7 @@ {% block title %}Création et modification de factures{% endblock %} {% block content %} -{% bootstrap_form_errors userform %} +{% bootstrap_form_errors factureform %}