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 %} + +{{ block.super }} +{% endblock %} \ No newline at end of file diff --git a/SMP/templates/smp_form.html b/SMP/templates/smp_form.html index 5aa7edf..4809e03 100644 --- a/SMP/templates/smp_form.html +++ b/SMP/templates/smp_form.html @@ -33,8 +33,6 @@ {% endblock %} {% block content %}




- - {% if validated %}
{% csrf_token %} @@ -47,8 +45,8 @@ {% for f in smp_form %} {% if f.name in static_fields %}
-
- +
+
@@ -57,16 +55,16 @@ {% endif %} {% endfor %} - {% for field in dynammic_fields %} -
+ {% for field in dynamic_fields %} +

{{field}}

{% for f in smp_form %} {% if field in f.name %} {% if f.is_hidden %} -