Compare commits

...

3 Commits

3 changed files with 31 additions and 10 deletions

View File

@ -142,8 +142,8 @@ class BorrowAdmin(VersionAdmin):
class GameAdmin(VersionAdmin, PolymorphicChildModelAdmin):
list_display = ('title', 'owner', 'duration', 'players_min',
'players_max', 'comment')
search_fields = ('name', 'owner__username', 'duration', 'comment')
'players_max', 'comment', 'isbn')
search_fields = ('isbn', 'title', 'owner__username', 'duration', 'comment')
autocomplete_fields = ('owner',)
show_in_index = True

View File

@ -0,0 +1,23 @@
# Generated by Django 2.2.24 on 2021-11-14 15:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0045_auto_20211114_1423'),
]
operations = [
migrations.AlterField(
model_name='membership',
name='date_end',
field=models.DateField(verbose_name='start date'),
),
migrations.AlterField(
model_name='membership',
name='date_start',
field=models.DateField(verbose_name='start date'),
),
]

View File

@ -59,12 +59,12 @@ class User(AbstractUser):
data : dict
Dictionary with user data to update.
"""
self.email = data['email']
self.first_name = data['first_name']
self.last_name = data['last_name']
self.phone_number = data['profile']['phone_number']
self.address = data['profile']['address']
self.comment = data['profile']['section']
self.email = data['email'] or ''
self.first_name = data['first_name'] or ''
self.last_name = data['last_name'] or ''
self.phone_number = data['profile']['phone_number'] or ''
self.address = data['profile']['address'] or ''
self.comment = data['profile']['section'] or ''
for membership_dict in data['memberships']:
if membership_dict['club'] != 22: # Med
@ -88,12 +88,10 @@ class Membership(models.Model):
)
date_start = models.DateField(
auto_now_add=True,
verbose_name=_('start date'),
)
date_end = models.DateField(
auto_now_add=True,
verbose_name=_('start date'),
)