diff --git a/cotisations/__init__.py b/cotisations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/cotisations/__pycache__/__init__.cpython-34.pyc b/cotisations/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 00000000..ca281b35 Binary files /dev/null and b/cotisations/__pycache__/__init__.cpython-34.pyc differ diff --git a/cotisations/__pycache__/admin.cpython-34.pyc b/cotisations/__pycache__/admin.cpython-34.pyc new file mode 100644 index 00000000..0e4e2221 Binary files /dev/null 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 new file mode 100644 index 00000000..30b89c47 Binary files /dev/null and b/cotisations/__pycache__/models.cpython-34.pyc differ diff --git a/cotisations/__pycache__/urls.cpython-34.pyc b/cotisations/__pycache__/urls.cpython-34.pyc new file mode 100644 index 00000000..5e1e4a2d Binary files /dev/null and b/cotisations/__pycache__/urls.cpython-34.pyc differ diff --git a/cotisations/__pycache__/views.cpython-34.pyc b/cotisations/__pycache__/views.cpython-34.pyc new file mode 100644 index 00000000..fa02e8e8 Binary files /dev/null and b/cotisations/__pycache__/views.cpython-34.pyc differ diff --git a/cotisations/admin.py b/cotisations/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/cotisations/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cotisations/migrations/0001_initial.py b/cotisations/migrations/0001_initial.py new file mode 100644 index 00000000..17471716 --- /dev/null +++ b/cotisations/migrations/0001_initial.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0005_auto_20160702_0006'), + ] + + operations = [ + migrations.CreateModel( + name='Article', + fields=[ + ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)), + ('name', models.CharField(max_length=255)), + ('prix', models.DecimalField(decimal_places=2, max_digits=5)), + ], + ), + migrations.CreateModel( + name='Banque', + fields=[ + ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)), + ('name', models.CharField(max_length=255)), + ], + ), + migrations.CreateModel( + name='Facture', + fields=[ + ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)), + ('cheque', models.CharField(max_length=255)), + ('number', models.IntegerField()), + ('date', models.DateTimeField(auto_now_add=True)), + ('name', models.CharField(max_length=255)), + ('prix', models.DecimalField(decimal_places=2, max_digits=5)), + ('article', models.ForeignKey(to='cotisations.Article', on_delete=django.db.models.deletion.PROTECT)), + ('banque', models.ForeignKey(to='cotisations.Banque', on_delete=django.db.models.deletion.PROTECT)), + ], + ), + migrations.CreateModel( + name='Paiement', + fields=[ + ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)), + ('moyen', models.CharField(max_length=255)), + ], + ), + migrations.AddField( + model_name='facture', + name='paiement', + field=models.ForeignKey(to='cotisations.Paiement', on_delete=django.db.models.deletion.PROTECT), + ), + migrations.AddField( + model_name='facture', + name='user', + field=models.ForeignKey(to='users.User', on_delete=django.db.models.deletion.PROTECT), + ), + ] diff --git a/cotisations/migrations/__init__.py b/cotisations/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/cotisations/migrations/__pycache__/0001_initial.cpython-34.pyc b/cotisations/migrations/__pycache__/0001_initial.cpython-34.pyc new file mode 100644 index 00000000..5f39a713 Binary files /dev/null and b/cotisations/migrations/__pycache__/0001_initial.cpython-34.pyc differ diff --git a/cotisations/migrations/__pycache__/__init__.cpython-34.pyc b/cotisations/migrations/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 00000000..ab177145 Binary files /dev/null and b/cotisations/migrations/__pycache__/__init__.cpython-34.pyc differ diff --git a/cotisations/models.py b/cotisations/models.py new file mode 100644 index 00000000..170cdd3a --- /dev/null +++ b/cotisations/models.py @@ -0,0 +1,68 @@ +from django.db import models +from django import forms +from django.forms import ModelForm + +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) + 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) + +class Article(models.Model): + name = models.CharField(max_length=255) + prix = models.DecimalField(max_digits=5, decimal_places=2) + + def __str__(self): + return self.name + +class Banque(models.Model): + name = models.CharField(max_length=255) + + def __str__(self): + return self.name + +class Paiement(models.Model): + moyen = models.CharField(max_length=255) + + def __str__(self): + return self.moyen + +class NewFactureForm(ModelForm): + article = forms.ModelMultipleChoiceField(queryset=Article.objects.all(), label="Article") + + 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 + self.fields['cheque'].label = 'Numero de chèque' + + class Meta: + model = Facture + exclude = ['name', 'prix'] + +class EditFactureForm(ModelForm): + def __init__(self, *args, **kwargs): + super(EditFactureForm, self).__init__(*args, **kwargs) + self.fields['user'].label = 'Adherent' + self.fields['number'].label = 'Quantité' + self.fields['cheque'].required = False + self.fields['banque'].required = False + self.fields['cheque'].label = 'Numero de chèque' + self.fields['name'].label = 'Designation' + self.fields['prix'].label = 'Prix unitaire' + + class Meta: + model = Facture + exclude = ['user'] diff --git a/cotisations/templates/cotisations/facture.html b/cotisations/templates/cotisations/facture.html new file mode 100644 index 00000000..8b2b9b58 --- /dev/null +++ b/cotisations/templates/cotisations/facture.html @@ -0,0 +1,14 @@ +{% extends "users/sidebar.html" %} +{% load bootstrap3 %} + +{% block title %}Création et modification de factures{% endblock %} + +{% block content %} +{% bootstrap_form_errors userform %} + +
+{% endblock %} diff --git a/cotisations/templates/cotisations/index.html b/cotisations/templates/cotisations/index.html new file mode 100644 index 00000000..a65b18ed --- /dev/null +++ b/cotisations/templates/cotisations/index.html @@ -0,0 +1,28 @@ +{% extends "cotisations/sidebar.html" %} +{% load bootstrap3 %} + +{% block title %}Facture{% endblock %} + +{% block content %} +Designation | +Utilisateur | +Article | +Moyen de paiement | +Date | +
---|---|---|---|---|
{{ facture_list.name }} | +{{ facture_list.user }} | +{{ facture_list.article }} | +{{ facture_list.paiement }} | +{{ facture_list.date }} | +