3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-22 03:13:12 +00:00

Add reason field on whitelists

This commit is contained in:
Yoann Pétri 2019-06-23 11:06:39 +02:00
parent 188b278532
commit 9ba037ec12
5 changed files with 32 additions and 3 deletions

View file

@ -50,9 +50,9 @@ class WhiteListHistoryAdmin(SimpleHistoryAdmin):
""" """
The admin class for :class:`Consumptions <users.models.WhiteListHistory>`. The admin class for :class:`Consumptions <users.models.WhiteListHistory>`.
""" """
list_display = ('user', 'paymentDate', 'endDate', 'duration') list_display = ('user', 'paymentDate', 'endDate', 'duration', 'reason')
ordering = ('user', 'duration', 'paymentDate', 'endDate') ordering = ('user', 'duration', 'paymentDate', 'endDate')
search_fields = ('user__username', 'user__first_name', 'user__last_name') search_fields = ('user__username', 'user__first_name', 'user__last_name', 'reason')
admin.site.register(Permission, SimpleHistoryAdmin) admin.site.register(Permission, SimpleHistoryAdmin)
admin.site.register(School, SimpleHistoryAdmin) admin.site.register(School, SimpleHistoryAdmin)

View file

@ -99,7 +99,7 @@ class addWhiteListHistoryForm(forms.ModelForm):
""" """
class Meta: class Meta:
model = WhiteListHistory model = WhiteListHistory
fields = ("duration", ) fields = ("duration", "reason")
class SchoolForm(forms.ModelForm): class SchoolForm(forms.ModelForm):
""" """

View file

@ -0,0 +1,23 @@
# Generated by Django 2.1 on 2019-06-23 09:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0007_auto_20190623_0957'),
]
operations = [
migrations.AddField(
model_name='historicalwhitelisthistory',
name='reason',
field=models.CharField(blank=True, max_length=255, verbose_name='Raison'),
),
migrations.AddField(
model_name='whitelisthistory',
name='reason',
field=models.CharField(blank=True, max_length=255, verbose_name='Raison'),
),
]

View file

@ -99,6 +99,10 @@ class WhiteListHistory(models.Model):
""" """
User (:class:`django.contrib.auth.models.User`) who registered the cotisation. User (:class:`django.contrib.auth.models.User`) who registered the cotisation.
""" """
reason = models.CharField(max_length=255, verbose_name="Raison", blank=True)
"""
Reason of the whitelist
"""
history = HistoricalRecords() history = HistoricalRecords()
class Profile(models.Model): class Profile(models.Model):

View file

@ -263,6 +263,7 @@
<th>Date de l'ajout</th> <th>Date de l'ajout</th>
<th>Date de fin</th> <th>Date de fin</th>
<th>Durée</th> <th>Durée</th>
<th>Raison</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -271,6 +272,7 @@
<td>{{whitelist.paymentDate}}</td> <td>{{whitelist.paymentDate}}</td>
<td>{{whitelist.endDate}}</td> <td>{{whitelist.endDate}}</td>
<td>{{whitelist.duration}} jours</td> <td>{{whitelist.duration}} jours</td>
<td>{{ whitelist.reason }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>