diff --git a/accounts/admin.py b/accounts/admin.py index 59bd3dde..798aa05c 100644 --- a/accounts/admin.py +++ b/accounts/admin.py @@ -14,7 +14,7 @@ class CustomUserAdmin(BaseUserAdmin): 'username', 'first_name', 'last_name', 'full_name', 'slack_display_name', 'current_lms_module', 'organisation', - 'timezone', 'user_type', 'is_external')}), + 'timezone', 'user_type', 'dropoffs', 'dropped_off_hackathon', 'is_external')}), ('Permissions', {'fields': ( 'is_active', 'is_staff', 'is_superuser', 'profile_is_public', 'email_is_public', diff --git a/accounts/migrations/0022_auto_20250214_1439.py b/accounts/migrations/0022_auto_20250214_1439.py new file mode 100644 index 00000000..bfc86057 --- /dev/null +++ b/accounts/migrations/0022_auto_20250214_1439.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.13 on 2025-02-14 14:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0021_auto_20250205_1138'), + ] + + operations = [ + migrations.AlterField( + model_name='customuser', + name='current_course', + field=models.CharField(choices=[('', 'Select Current Course'), ('L3', 'The Level 3 Diploma in Software Development (L3)'), ('5P', 'The 5 project Diploma in Software Development Course (5P)'), ('4P', 'The 4 project Diploma in Software Development Course (4P)'), ('FSBC', 'The 16 Week Full Stack Developer Bootcamp (BC)'), ('DATABC', 'The 16 Week Data-Analytics Bootcamp (DBC)'), ('external', 'Other/External')], default='', max_length=50), + ), + ] diff --git a/accounts/migrations/0023_merge_20250217_0913.py b/accounts/migrations/0023_merge_20250217_0913.py new file mode 100644 index 00000000..d75d5c6f --- /dev/null +++ b/accounts/migrations/0023_merge_20250217_0913.py @@ -0,0 +1,14 @@ +# Generated by Django 3.1.13 on 2025-02-17 09:13 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0022_auto_20250214_1439'), + ('accounts', '0022_auto_20250206_1702'), + ] + + operations = [ + ] diff --git a/accounts/migrations/0024_customuser_dropoffs.py b/accounts/migrations/0024_customuser_dropoffs.py new file mode 100644 index 00000000..b9d5ba86 --- /dev/null +++ b/accounts/migrations/0024_customuser_dropoffs.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.13 on 2025-02-17 12:15 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0023_merge_20250217_0913'), + ] + + operations = [ + migrations.AddField( + model_name='customuser', + name='dropoffs', + field=models.IntegerField(default=0, help_text='Number of times a user has dropped off from a hackathon'), + ), + ] diff --git a/accounts/migrations/0025_customuser_dropped_off_hackathon.py b/accounts/migrations/0025_customuser_dropped_off_hackathon.py new file mode 100644 index 00000000..129bb991 --- /dev/null +++ b/accounts/migrations/0025_customuser_dropped_off_hackathon.py @@ -0,0 +1,20 @@ +# Generated by Django 3.1.13 on 2025-02-19 14:54 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('hackathon', '0056_hackathon_badge_url'), + ('accounts', '0024_customuser_dropoffs'), + ] + + operations = [ + migrations.AddField( + model_name='customuser', + name='dropped_off_hackathon', + field=models.ForeignKey(blank=True, help_text='The hackathon that the user dropped off from', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dropped_off_users', to='hackathon.hackathon'), + ), + ] diff --git a/accounts/models.py b/accounts/models.py index 4f2367ce..245e4c6e 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -119,6 +119,20 @@ class CustomUser(AbstractUser): choices=TIMEZONE_CHOICES, ) + dropoffs = models.IntegerField( + default=0, + help_text=("Number of times a user has dropped off from a hackathon") + ) + + dropped_off_hackathon = models.ForeignKey( + 'hackathon.Hackathon', + on_delete=models.SET_NULL, + related_name='dropped_off_users', + null=True, + blank=True, + help_text=("The hackathon that the user dropped off from") + ) + class Meta: verbose_name = 'User' verbose_name_plural = 'Users' @@ -141,6 +155,7 @@ def to_team_member(self): 'timezone': self.timezone_to_offset(), 'num_hackathons': teams.count(), 'participant_label': self.participant_label(), + 'dropoffs': self.dropoffs, } def timezone_to_offset(self): diff --git a/hackadmin/templates/includes/remove_participant.html b/hackadmin/templates/includes/remove_participant.html index 297e3cbf..0058b450 100644 --- a/hackadmin/templates/includes/remove_participant.html +++ b/hackadmin/templates/includes/remove_participant.html @@ -1,4 +1,4 @@ -