mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-04 09:12:11 +01:00 
			
		
		
		
	Admin for club
This commit is contained in:
		@@ -7,7 +7,7 @@ from django.contrib.auth.admin import UserAdmin
 | 
				
			|||||||
from django.contrib.auth.models import User
 | 
					from django.contrib.auth.models import User
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .forms import CustomUserChangeForm
 | 
					from .forms import CustomUserChangeForm
 | 
				
			||||||
from .models import Profile
 | 
					from .models import Profile, Club
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ProfileInline(admin.StackedInline):
 | 
					class ProfileInline(admin.StackedInline):
 | 
				
			||||||
@@ -35,3 +35,4 @@ class CustomUserAdmin(UserAdmin):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
admin.site.unregister(User)
 | 
					admin.site.unregister(User)
 | 
				
			||||||
admin.site.register(User, CustomUserAdmin)
 | 
					admin.site.register(User, CustomUserAdmin)
 | 
				
			||||||
 | 
					admin.site.register(Club)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,7 +56,7 @@ msgstr "courriel"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#: models.py:70
 | 
					#: models.py:70
 | 
				
			||||||
msgid "membership fee"
 | 
					msgid "membership fee"
 | 
				
			||||||
msgstr "cotisation"
 | 
					msgstr "cotisation pour adhérer"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: models.py:74
 | 
					#: models.py:74
 | 
				
			||||||
msgid "membership duration"
 | 
					msgid "membership duration"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,8 +59,9 @@ class Club(models.Model):
 | 
				
			|||||||
    A student club
 | 
					    A student club
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    name = models.CharField(
 | 
					    name = models.CharField(
 | 
				
			||||||
        verbose_name=_('paid'),
 | 
					        verbose_name=_('name'),
 | 
				
			||||||
        max_length=255,
 | 
					        max_length=255,
 | 
				
			||||||
 | 
					        unique=True,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    email = models.EmailField(
 | 
					    email = models.EmailField(
 | 
				
			||||||
        verbose_name=_('email'),
 | 
					        verbose_name=_('email'),
 | 
				
			||||||
@@ -94,6 +95,9 @@ class Club(models.Model):
 | 
				
			|||||||
        verbose_name = _("club")
 | 
					        verbose_name = _("club")
 | 
				
			||||||
        verbose_name_plural = _("clubs")
 | 
					        verbose_name_plural = _("clubs")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def __str__(self):
 | 
				
			||||||
 | 
					        return self.name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Role(models.Model):
 | 
					class Role(models.Model):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
@@ -102,6 +106,7 @@ class Role(models.Model):
 | 
				
			|||||||
    name = models.CharField(
 | 
					    name = models.CharField(
 | 
				
			||||||
        verbose_name=_('name'),
 | 
					        verbose_name=_('name'),
 | 
				
			||||||
        max_length=255,
 | 
					        max_length=255,
 | 
				
			||||||
 | 
					        unique=True,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class Meta:
 | 
					    class Meta:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,8 @@ class NoteClubAdmin(admin.ModelAdmin):
 | 
				
			|||||||
    """
 | 
					    """
 | 
				
			||||||
    inlines = (AliasInlines,)
 | 
					    inlines = (AliasInlines,)
 | 
				
			||||||
    list_display = ('club', 'balance', 'is_active')
 | 
					    list_display = ('club', 'balance', 'is_active')
 | 
				
			||||||
 | 
					    list_filter = ('is_active',)
 | 
				
			||||||
 | 
					    search_fields = ['club__name']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class NoteSpecialAdmin(admin.ModelAdmin):
 | 
					class NoteSpecialAdmin(admin.ModelAdmin):
 | 
				
			||||||
@@ -32,9 +34,12 @@ class NoteUserAdmin(admin.ModelAdmin):
 | 
				
			|||||||
    """
 | 
					    """
 | 
				
			||||||
    inlines = (AliasInlines,)
 | 
					    inlines = (AliasInlines,)
 | 
				
			||||||
    list_display = ('user', 'balance', 'is_active')
 | 
					    list_display = ('user', 'balance', 'is_active')
 | 
				
			||||||
 | 
					    list_filter = ('is_active',)
 | 
				
			||||||
 | 
					    search_fields = ['user__username']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Organize note by registration date
 | 
					    # Organize note by registration date
 | 
				
			||||||
    date_hierarchy = 'user__date_joined'
 | 
					    date_hierarchy = 'user__date_joined'
 | 
				
			||||||
 | 
					    ordering = ['-user__date_joined']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Register your models here.
 | 
					# Register your models here.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user