From ff23250275fd0ca72724fa5d97573cd34ab7403a Mon Sep 17 00:00:00 2001 From: Starthur Date: Mon, 1 Aug 2022 22:15:58 +0200 Subject: [PATCH] Remove old field --- src/accounts/admin.py | 6 ++--- .../migrations/0012_auto_20220801_2212.py | 25 +++++++++++++++++++ src/accounts/models.py | 4 +-- 3 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 src/accounts/migrations/0012_auto_20220801_2212.py diff --git a/src/accounts/admin.py b/src/accounts/admin.py index 03dfdfb..441b02c 100644 --- a/src/accounts/admin.py +++ b/src/accounts/admin.py @@ -8,10 +8,10 @@ from .models import Campus @admin.register(UserProfileInfo) class userprofile(admin.ModelAdmin): #list display - list_display = ['user', 'score', 'last_submission_date', 'intra42_campus'] + list_display = ['user', 'score', 'last_submission_date', 'campus'] # search list - search_fields = ['score', 'user__username', 'intra42_campus'] + search_fields = ['score', 'user__username', 'campus'] @admin.register(Campus) class campus(admin.ModelAdmin): - list_display = ['name'] \ No newline at end of file + list_display = ['name'] diff --git a/src/accounts/migrations/0012_auto_20220801_2212.py b/src/accounts/migrations/0012_auto_20220801_2212.py new file mode 100644 index 0000000..0fdf7e2 --- /dev/null +++ b/src/accounts/migrations/0012_auto_20220801_2212.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.11 on 2022-08-01 20:12 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0011_migration_campus'), + ] + + operations = [ + migrations.AlterModelOptions( + name='userprofileinfo', + options={'ordering': ['-score', 'last_submission_date', 'user__username', 'campus'], 'permissions': (('view_info', 'View user info'),), 'verbose_name': 'profile', 'verbose_name_plural': 'profiles'}, + ), + migrations.RemoveField( + model_name='userprofileinfo', + name='intra42_campus', + ), + migrations.RemoveField( + model_name='userprofileinfo', + name='intra42_campus_id', + ), + ] diff --git a/src/accounts/models.py b/src/accounts/models.py index 7bf0c2a..0514306 100644 --- a/src/accounts/models.py +++ b/src/accounts/models.py @@ -14,15 +14,13 @@ class UserProfileInfo(models.Model): discord_id = models.CharField(max_length=20, null=True, blank=True, unique=True) intra42_id = models.CharField(max_length=20, null=True, blank=True, unique=True) campus = models.ForeignKey('Campus', on_delete=models.DO_NOTHING, null=True, blank=True) - intra42_campus = models.CharField(max_length=50, null=True, blank=True) - intra42_campus_id = models.CharField(max_length=10, null=True, blank=True) member = models.BooleanField(default=False) member_since = models.DateTimeField('Member since', default=timezone.now) member_until = models.DateTimeField('Member until', default=timezone.now) def __str__(self): return self.user.username class Meta: - ordering = ['-score', 'last_submission_date', 'user__username', 'intra42_campus'] + ordering = ['-score', 'last_submission_date', 'user__username', 'campus'] verbose_name = 'profile' verbose_name_plural = 'profiles' permissions = (("view_info", "View user info"),)