diff --git a/.gitignore b/.gitignore index b03b2bd..23c6c75 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ __pycache__/ .vscode/ venv/ *.pyc +.idea db.sqlite3 stderr.log diff --git a/ACM_Website/settings.py b/ACM_Website/settings.py index ead6b77..6170e3a 100644 --- a/ACM_Website/settings.py +++ b/ACM_Website/settings.py @@ -50,6 +50,7 @@ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'acm.my_middleware.CustomCorsMiddleware' ] ROOT_URLCONF = 'ACM_Website.urls' diff --git a/SMP/admin.py b/SMP/admin.py index 22236db..a9e9beb 100644 --- a/SMP/admin.py +++ b/SMP/admin.py @@ -1,6 +1,23 @@ from django.contrib import admin -from acm.models import SIG +from django.urls import path from .models import * +from SMP.views import new_smp -admin.site.register(SMP) -admin.site.register(SMP_des) + +@admin.register(SMP) +class SMPAdmin(admin.ModelAdmin): + def has_add_permission(self, request): + return False + + def get_urls(self): + urls = super().get_urls() + urls = [ + path('add_smp/', self.admin_site.admin_view(new_smp)) + ] + urls + return urls + + +@admin.register(SMP_des) +class SMP_desAdmin(admin.ModelAdmin): + def has_add_permission(self, request): + return False diff --git a/SMP/templates/admin/index.html b/SMP/templates/admin/index.html new file mode 100644 index 0000000..bfbfb62 --- /dev/null +++ b/SMP/templates/admin/index.html @@ -0,0 +1,10 @@ +{% extends "admin/index.html" %} + +{% block content %} +