Skip to content

Commit

Permalink
Add registration time
Browse files Browse the repository at this point in the history
  • Loading branch information
Princekumarofficial committed Sep 3, 2024
1 parent 540cc00 commit 999728c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
5 changes: 4 additions & 1 deletion home/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ class about_Admin(ImportExportModelAdmin, admin.ModelAdmin):
"email__degree",
"email__department",
)
list_display = ("student_id", "name", "email", "period", "caterer", "jain")
list_display = ("student_id", "name", "email", "period", "caterer", "jain", "registration_time",)
fieldsets = (
(
None,
Expand All @@ -957,12 +957,15 @@ class about_Admin(ImportExportModelAdmin, admin.ModelAdmin):
"first_pref",
"second_pref",
"third_pref",
"registration_time",
),
"description": "%s" % ALLOCATION_DESC_TEXT,
},
),
)

readonly_fields=("registration_time",)

def get_queryset(self, request):
qs = super().get_queryset(request)
if request.user.is_superuser:
Expand Down
18 changes: 18 additions & 0 deletions home/migrations/0004_allocation_registration_time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.8 on 2024-09-03 14:38

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('home', '0003_allocationform_show_allocated'),
]

operations = [
migrations.AddField(
model_name='allocation',
name='registration_time',
field=models.DateTimeField(auto_now_add=True, help_text='This contains the time of registration', null=True, verbose_name='Registration time'),
),
]
8 changes: 8 additions & 0 deletions home/models/allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ class Allocation(models.Model):
null=True,
blank=True,
)
registration_time = models.DateTimeField(
_("Registration time"),
auto_now_add=True,
blank=True,
null=True,
help_text="This contains the time of registration",
editable=True,
)

def __str__(self):
return self.student_id
Expand Down
13 changes: 9 additions & 4 deletions messWebsite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,37 @@
SECRET_KEY = env("SECRET_KEY")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True

ALLOWED_HOSTS = ["diningfee.iiti.ac.in", "127.0.0.1"]
CSRF_TRUSTED_ORIGINS = ["http://diningfee.iiti.ac.in", "https://diningfee.iiti.ac.in"]
# Application definition

INSTALLED_APPS = [
# Django apps
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"django.contrib.admindocs",

# Third-party apps
"import_export",
"django_admin_logs",
"home.apps.HomeConfig",
"django.contrib.sites",
"allauth",
"allauth.account",
"allauth.socialaccount",
"allauth.socialaccount.providers.google",
"django.contrib.admindocs",
"cloudinary_storage",
"cloudinary",
"apscheduler",
"django_apscheduler",

# Local apps
"home.apps.HomeConfig",
]

MIDDLEWARE = [
Expand Down

0 comments on commit 999728c

Please sign in to comment.