Merge branch 'beta' into 'master'

Fix import

See merge request bde/nk20!88
This commit is contained in:
ynerant 2020-08-01 18:11:01 +02:00
commit 1fd7d76412
6 changed files with 34 additions and 11 deletions

View File

@ -3,9 +3,11 @@
from django.contrib import admin from django.contrib import admin
from .models import Activity, ActivityType, Guest from note_kfet.admin import admin_site
from .models import Activity, ActivityType, Guest, Entry
@admin.register(Activity, site=admin_site)
class ActivityAdmin(admin.ModelAdmin): class ActivityAdmin(admin.ModelAdmin):
""" """
Admin customisation for Activity Admin customisation for Activity
@ -19,6 +21,7 @@ class ActivityAdmin(admin.ModelAdmin):
ordering = ['-date_start'] ordering = ['-date_start']
@admin.register(ActivityType, site=admin_site)
class ActivityTypeAdmin(admin.ModelAdmin): class ActivityTypeAdmin(admin.ModelAdmin):
""" """
Admin customisation for ActivityType Admin customisation for ActivityType
@ -26,7 +29,17 @@ class ActivityTypeAdmin(admin.ModelAdmin):
list_display = ('name', 'can_invite', 'guest_entry_fee') list_display = ('name', 'can_invite', 'guest_entry_fee')
# Register your models here. @admin.register(Guest, site=admin_site)
admin.site.register(Activity, ActivityAdmin) class GuestAdmin(admin.ModelAdmin):
admin.site.register(ActivityType, ActivityTypeAdmin) """
admin.site.register(Guest) Admin customisation for Guest
"""
list_display = ('last_name', 'first_name', 'activity', 'inviter')
@admin.register(Entry, site=admin_site)
class EntryAdmin(admin.ModelAdmin):
"""
Admin customisation for Entry
"""
list_display = ('note', 'activity', 'time', 'guest')

View File

@ -5,6 +5,7 @@ from datetime import timedelta, datetime
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import Q
from django.utils import timezone
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from rest_framework.exceptions import ValidationError from rest_framework.exceptions import ValidationError
from note.models import NoteUser, Transaction from note.models import NoteUser, Transaction
@ -98,6 +99,9 @@ class Activity(models.Model):
verbose_name=_('open'), verbose_name=_('open'),
) )
def __str__(self):
return self.name
class Meta: class Meta:
verbose_name = _("activity") verbose_name = _("activity")
verbose_name_plural = _("activities") verbose_name_plural = _("activities")
@ -118,7 +122,7 @@ class Entry(models.Model):
) )
time = models.DateTimeField( time = models.DateTimeField(
auto_now_add=True, default=timezone.now,
verbose_name=_("entry time"), verbose_name=_("entry time"),
) )
@ -233,6 +237,9 @@ class Guest(models.Model):
return super().save(force_insert, force_update, using, update_fields) return super().save(force_insert, force_update, using, update_fields)
def __str__(self):
return self.first_name + " " + self.last_name
class Meta: class Meta:
verbose_name = _("guest") verbose_name = _("guest")
verbose_name_plural = _("guests") verbose_name_plural = _("guests")

View File

@ -5,6 +5,7 @@ from django.conf import settings
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
@ -68,7 +69,7 @@ class Changelog(models.Model):
timestamp = models.DateTimeField( timestamp = models.DateTimeField(
null=False, null=False,
blank=False, blank=False,
auto_now_add=True, default=timezone.now,
name='timestamp', name='timestamp',
verbose_name=_('timestamp'), verbose_name=_('timestamp'),
) )

View File

@ -7,6 +7,7 @@ from django.conf import settings
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator from django.core.validators import RegexValidator
from django.db import models from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from polymorphic.models import PolymorphicModel from polymorphic.models import PolymorphicModel
@ -51,7 +52,7 @@ class Note(PolymorphicModel):
) )
created_at = models.DateTimeField( created_at = models.DateTimeField(
verbose_name=_('created at'), verbose_name=_('created at'),
auto_now_add=True, default=timezone.now,
) )
class Meta: class Meta:

@ -1 +1 @@
Subproject commit e16629cc70c155e4d32244f80684295b459a8a59 Subproject commit dce51ad26134d396d7cbfca7c63bd2ed391dd969

View File

@ -6,6 +6,7 @@ from django.contrib.auth.models import User
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import Q
from django.utils import timezone
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from note.models import NoteSpecial, SpecialTransaction, MembershipTransaction from note.models import NoteSpecial, SpecialTransaction, MembershipTransaction
@ -53,7 +54,7 @@ class Invoice(models.Model):
) )
date = models.DateField( date = models.DateField(
auto_now_add=True, default=timezone.now,
verbose_name=_("Place"), verbose_name=_("Place"),
) )
@ -130,7 +131,7 @@ class Remittance(models.Model):
""" """
date = models.DateTimeField( date = models.DateTimeField(
auto_now_add=True, default=timezone.now,
verbose_name=_("Date"), verbose_name=_("Date"),
) )