# Path: src/ctf_gameserver/web/registration/models.py
# class Team(models.Model):
#     """
#     Database representation of a team participating in the competition.
#     This enhances the user model, where the team name, password, formal email address etc. are stored. It is
#     particularly attuned to django.contrib.auth.models.User, but should work with other user models as well.
#     """
# 
#     user = models.OneToOneField(settings.AUTH_USER_MODEL, primary_key=True, on_delete=models.CASCADE)
# 
#     net_number = models.PositiveSmallIntegerField(null=True, unique=True)
#     informal_email = models.EmailField(_('Informal email address'))
#     image = ThumbnailImageField(upload_to=_gen_image_name, blank=True)
#     affiliation = models.CharField(max_length=100, blank=True)
#     country = models.CharField(max_length=100)
#     # NOP teams don't get included in the scoring
#     nop_team = models.BooleanField(default=False, db_index=True)
# 
#     class ActiveObjectsManager(models.Manager):
#         def get_queryset(self):
#             return super().get_queryset().filter(user__is_active=True)
# 
#     class ActiveNotNopObjectsManager(ActiveObjectsManager):
#         def get_queryset(self):
#             return super().get_queryset().filter(nop_team=False)
# 
#     # The first Manager in a class is used as default
#     objects = models.Manager()
#     # QuerySet that only returns Teams whose associated user object is not marked as inactive
#     active_objects = ActiveObjectsManager()
#     # QuerySet that only returns active Teams that are not marked as NOP team
#     active_not_nop_objects = ActiveNotNopObjectsManager()
# 
#     def __str__(self):
#         # pylint: disable=no-member
#         return self.user.username
# 
# Path: src/ctf_gameserver/web/registration/forms.py
# class AdminTeamForm(forms.ModelForm):
#     """
#     Form for Team objects to be used in TeamAdmin.
#     """
# 
#     class Meta:
#         fields = '__all__'
#         labels = {
#             'nop_team': _('NOP team')
#         }
#         help_texts = {
#             'nop_team': _("NOP teams are meant for demo purposes (to provide a reference image) and don't "
#                           "get included in the scoring.")
#         }


from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from .models import Team
from .forms import AdminTeamForm



class InlineTeamAdmin(admin.StackedInline):
    """
    InlineModelAdmin for Team objects. Primarily designed to be used within a UserAdmin.
    """

    model = Team

# Path: src/ctf_gameserver/web/registration/models.py
# class Team(models.Model):
#     """
#     Database representation of a team participating in the competition.
#     This enhances the user model, where the team name, password, formal email address etc. are stored. It is
#     particularly attuned to django.contrib.auth.models.User, but should work with other user models as well.
#     """
# 
#     user = models.OneToOneField(settings.AUTH_USER_MODEL, primary_key=True, on_delete=models.CASCADE)
# 
#     net_number = models.PositiveSmallIntegerField(null=True, unique=True)
#     informal_email = models.EmailField(_('Informal email address'))
#     image = ThumbnailImageField(upload_to=_gen_image_name, blank=True)
#     affiliation = models.CharField(max_length=100, blank=True)
#     country = models.CharField(max_length=100)
#     # NOP teams don't get included in the scoring
#     nop_team = models.BooleanField(default=False, db_index=True)
# 
#     class ActiveObjectsManager(models.Manager):
#         def get_queryset(self):
#             return super().get_queryset().filter(user__is_active=True)
# 
#     class ActiveNotNopObjectsManager(ActiveObjectsManager):
#         def get_queryset(self):
#             return super().get_queryset().filter(nop_team=False)
# 
#     # The first Manager in a class is used as default
#     objects = models.Manager()
#     # QuerySet that only returns Teams whose associated user object is not marked as inactive
#     active_objects = ActiveObjectsManager()
#     # QuerySet that only returns active Teams that are not marked as NOP team
#     active_not_nop_objects = ActiveNotNopObjectsManager()
# 
#     def __str__(self):
#         # pylint: disable=no-member
#         return self.user.username
# 
# Path: src/ctf_gameserver/web/registration/forms.py
# class AdminTeamForm(forms.ModelForm):
#     """
#     Form for Team objects to be used in TeamAdmin.
#     """
# 
#     class Meta:
#         fields = '__all__'
#         labels = {
#             'nop_team': _('NOP team')
#         }
#         help_texts = {
#             'nop_team': _("NOP teams are meant for demo purposes (to provide a reference image) and don't "
#                           "get included in the scoring.")
#         }


# Path: src/ctf_gameserver/web/registration/admin.py
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from .models import Team
from .forms import AdminTeamForm




class InlineTeamAdmin(admin.StackedInline):
    """
    InlineModelAdmin for Team objects. Primarily designed to be used within a UserAdmin.
    """

    model = Team

    form = AdminTeamForm