diff --git a/.gitignore b/.gitignore
index dc5782d..2f3533c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
*.swp
**/__pycache__
db.sqlite3
+*.sqlite3
media
# Backup files #
diff --git a/access_ctrl/admin.py b/access_ctrl/admin.py
index 6ecdf16..e5595c6 100644
--- a/access_ctrl/admin.py
+++ b/access_ctrl/admin.py
@@ -1,8 +1,36 @@
from django.contrib import admin
from .models import *
+from django.contrib.auth.models import User
+from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
# Register your models here.
+class CustomUserAdmin(BaseUserAdmin):
+ # Remove 'groups' and 'user_permissions' from the fieldsets
+ fieldsets = (
+ (None, {'fields': ('username', 'password')}),
+ ('Personal info', {'fields': ('first_name', 'last_name', 'email')}),
+ ('Important dates', {'fields': ('last_login', 'date_joined')}),
+ ('Status', {'fields': ('is_active', 'is_staff', 'is_superuser', 'user_permissions')}),
+ )
+
+ # Remove them from add_fieldsets too (user creation form)
+ add_fieldsets = (
+ (None, {
+ 'classes': ('wide',),
+ 'fields': ('username', 'password1', 'password2'),
+ }),
+ )
+
+ # Hide columns in the list display if you don’t want them there
+ def get_fieldsets(self, request, obj=None):
+ return super().get_fieldsets(request, obj)
+
+# Unregister the original UserAdmin
+admin.site.unregister(User)
+# Register our custom one
+admin.site.register(User, CustomUserAdmin)
+
# -----------------------------
# Permission Admin
# -----------------------------
@@ -27,7 +55,7 @@ class RoleAdmin(admin.ModelAdmin):
@admin.register(RolePermission)
class RolePermissionAdmin(admin.ModelAdmin):
list_display = ("role",)
- filter_horizontal = ("permissions",) # Makes ManyToMany easy to edit
+ filter_horizontal = ("permissions",)
search_fields = ("role__name",)
# -----------------------------
@@ -36,7 +64,7 @@ class RolePermissionAdmin(admin.ModelAdmin):
@admin.register(UserPermission)
class UserPermissionAdmin(admin.ModelAdmin):
list_display = ("user",)
- filter_horizontal = ("permissions",) # Makes ManyToMany easy to edit
+ filter_horizontal = ("permissions",)
search_fields = ("user__username",)
# -----------------------------
diff --git a/access_ctrl/apps.py b/access_ctrl/apps.py
index eef60d2..75b33d8 100644
--- a/access_ctrl/apps.py
+++ b/access_ctrl/apps.py
@@ -1,6 +1,22 @@
from django.apps import AppConfig
+from django.contrib.auth.apps import AuthConfig as BaseAuthConfig
class AccessCtrlConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'access_ctrl'
+
+class CustomAuthConfig(BaseAuthConfig):
+ verbose_name = "User Management"
+
+ def ready(self):
+ super().ready() # registers User & Group
+ from django.contrib import admin
+ from django.contrib.auth.models import Group
+
+ # Unregister Group after it's registered
+ try:
+ admin.site.unregister(Group)
+ except admin.sites.NotRegistered:
+ pass
+
diff --git a/access_ctrl/utils.py b/access_ctrl/utils.py
index 790ea4e..64c3a7e 100644
--- a/access_ctrl/utils.py
+++ b/access_ctrl/utils.py
@@ -7,6 +7,9 @@ def user_has_permission(user, codename, obj=None):
"""
Check if a user has a permission, directly, via role, or object-level.
"""
+ if user.is_superuser:
+ return True
+
try:
perm = Perms.objects.get(codename=codename)
except Perms.DoesNotExist:
diff --git a/core/admin.py b/core/admin.py
index 62bc1f2..dad469e 100644
--- a/core/admin.py
+++ b/core/admin.py
@@ -2,6 +2,7 @@
from core.models import Token_Session, Registered_Participant, Token_Participant
# Register your models here.
+
@admin.register(Token_Session)
class SessionAdmin(admin.ModelAdmin):
diff --git a/core/static/img/Footer.png b/core/static/img/Footer.png
new file mode 100644
index 0000000..36c179e
Binary files /dev/null and b/core/static/img/Footer.png differ
diff --git a/core/static/img/Footer1.png b/core/static/img/Footer1.png
new file mode 100644
index 0000000..5132d43
Binary files /dev/null and b/core/static/img/Footer1.png differ
diff --git a/core/static/img/Footer2.png b/core/static/img/Footer2.png
new file mode 100644
index 0000000..e0bf3a4
Binary files /dev/null and b/core/static/img/Footer2.png differ
diff --git a/core/static/img/Stepclosed.png b/core/static/img/Stepclosed.png
new file mode 100644
index 0000000..1cdd987
Binary files /dev/null and b/core/static/img/Stepclosed.png differ
diff --git a/core/templates/coordinator_dashboard.html b/core/templates/coordinator_dashboard.html
index 3b25c2f..b77f700 100644
--- a/core/templates/coordinator_dashboard.html
+++ b/core/templates/coordinator_dashboard.html
@@ -246,17 +246,21 @@
justify-content: space-between;
}
.footer {
+ display: flex;
+ margin: auto;
+ justify-content: center;
+ gap: 250px;
background-color: #f8f8f8;
/* color: white; */
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
- padding: 10px 0;
+ /* padding: 10px 0; */
/* z-index: -1; */
}
.footer img {
- height: 68px;
+ height: 90px;
}
.count {
font-size: 1.5rem;
@@ -485,8 +489,12 @@
td {
padding: 5px;
}
+ .footer{
+ gap: 40px;
+ }
.footer img {
- height: 27px;
+ height: 30px;
+ /* scale: 1.3; */
}
.count {
font-size: 1rem;
@@ -529,11 +537,11 @@
- {% if request.user|has_perm:"update_session" %}
+ {% if has_perm.update_session %}
{% endif %}
- Registration Form
- {% if request.user|has_perm:"scan_session" %}
+ Registration Form
+ {% if has_perm.scan_session %}
{% endif %}
@@ -611,10 +619,10 @@
Name
University
Tshirt Size
-
Role
+ {% comment %}
Role
{% endcomment %}
Contact
{% for session in token_sessions_all %}
- {% if request.user|has_perm:"scan_any_session" or session.is_active %}
+ {% if has_perm.scan_any_session or session.is_active %}
{{session.session_name}}
{% endif %}
{% endfor %}
@@ -628,10 +636,10 @@
{{participant.name}}
{{participant.university}}
{{participant.t_shirt_size}}
-
{{participant.role}}
+ {% comment %}
{{participant.role}}
{% endcomment %}
{{participant.contact_no}}
{% for session in token_sessions_all %}
- {% if request.user|has_perm:"scan_any_session" or session.is_active %}
+ {% if has_perm.scan_any_session or session.is_active %}
@@ -654,7 +662,8 @@
Select a Session
- {% if request.user|has_perm:"update_session" %}
+ {% if has_perm.update_session %}
@@ -756,7 +765,7 @@
Select a Session
const modalOverlay = document.getElementById("modal-overlay");
const navbarSessionText = document.querySelector(".navbar > div");
- {% if request.user|has_perm:"update_session" %}
+ {% if has_perm.update_session %}
// Open the modal
setSessionBtn.addEventListener("click", () => {
modalOverlay.style.display = "block";
@@ -836,7 +845,7 @@
Select a Session
// Example session URLs
const sessions = [
{% for session in token_sessions_all %}
- {% if request.user|has_perm:"scan_any_session" or session.is_active %}
+ {% if has_perm.scan_any_session or session.is_active %}
{ id: {{session.id}}, name: "{{session.session_name}}" },
{% endif %}
{% endfor %}
@@ -1175,7 +1184,7 @@
Select a Session
.then((data) => {
last_updated_date_time = new Date();
- {% if request.user|has_perm:"scan_any_session" %}
+ {% if has_perm.scan_any_session %}
for (var d in data['status']) {
document.getElementById(`session_${d}`).innerHTML = data['status'][d];
}
diff --git a/core/views.py b/core/views.py
index 65d0c94..ff458ef 100644
--- a/core/views.py
+++ b/core/views.py
@@ -98,6 +98,12 @@ def dashboard(request):
registered_participants = Core.get_all_reg_participants_with_sessions()
total_participants = len(registered_participants)
+
+ permissions = {
+ 'update_session':Site_Permissions.user_has_permission(request.user, 'update_session'),
+ 'scan_session':Site_Permissions.user_has_permission(request.user, 'scan_session'),
+ 'scan_any_session':Site_Permissions.user_has_permission(request.user, 'scan_any_session')
+ }
request.session['active_sessions'] = active_sessions
@@ -108,6 +114,7 @@ def dashboard(request):
'registered_participants':registered_participants,
'total_participants':total_participants,
'participant_universities':universities,
+ 'has_perm':permissions,
}
return render(request, 'coordinator_dashboard.html', context)
@@ -115,7 +122,7 @@ def dashboard(request):
class SessionUpdateAjax(View):
def post(self, request):
try:
- if request.user.is_authenticated and Site_Permissions.user_has_permission(request.user, 'update_session'):
+ if Site_Permissions.user_has_permission(request.user, 'update_session'):
sessions = json.loads(request.body)['sessions']
if(Core.update_session(sessions=sessions)):
@@ -139,7 +146,7 @@ def get(self, request):
class GetSessionStatusAjax(View):
def post(self, request):
try:
- if request.user.is_authenticated and Site_Permissions.user_has_permission(request.user, 'view_qr_dashboard'):
+ if Site_Permissions.user_has_permission(request.user, 'view_qr_dashboard'):
last_updated_date_time = json.loads(request.body)['last_updated_date_time']
token_sessions_with_participant_count = Core.get_all_token_sessions_with_participant_counts()
@@ -170,7 +177,7 @@ def get(self, request):
class UpdateParticipantSessionAjax(View):
def post(self, request):
try:
- if request.user.is_authenticated and Site_Permissions.user_has_permission(request.user, 'scan_session'):
+ if Site_Permissions.user_has_permission(request.user, 'scan_session'):
data = json.loads(request.body)
response = Core.update_participant_session(data['participant_id'], data['session_id'], data['status'])
diff --git a/emails/templates/email_template_step25.html b/emails/templates/email_template_step25.html
new file mode 100644
index 0000000..3077f04
--- /dev/null
+++ b/emails/templates/email_template_step25.html
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Dear {{name}},
+
+
We are delighted to confirm your registration for IEEE Student
+Transition and Elevation Partnership (STEP) 2025 - an event designed to
+connect academic learning with professional excellence. This distinguished
+program is being organized jointly by IEEE NSU Student Branch, IEEE
+Bangladesh Section, and IEEE Young Professionals Bangladesh and will take
+place on September 27th at North South University.
+
+
Event Location: North South
+University
+Access Gate: Gate No. 3
+Reporting Time: 9:00 PM
+Recommendation: We encourage you to bring your laptop if available.
+
+
Important Note: In case you
+are running late, please contact +8801919356207.
+
+
For your convenience, the program schedule has been
+included with this email. Additionally, you will find a QR code entry token
+attached. Please save this QR code to your mobile device, as it will be
+mandatory for gate access.
+
+
Dress Code:
+
+
●
+For Men: Semi-formal attire
+
+
●For Women: Semi-formal
+attire or Salwar Kameez
+
+
We are excited to welcome you to STEP 2025, where you will
+enhance your professional skills, gain valuable industry insights, and build
+meaningful connections for your career advancement.