Added filter functionality and combined both base.html
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def create_permissions(apps, schema_editor):
|
||||
EmployeePermission = apps.get_model('accounts', 'EmployeePermission')
|
||||
ClientPermission = apps.get_model('accounts', 'ClientPermission')
|
||||
|
||||
employee_permissions = [
|
||||
(1, 'can_manage_containers', 'Can manage containers'),
|
||||
(2, 'can_view_reports', 'Can view reports'),
|
||||
(3, 'can_handle_operations', 'Can handle operations'),
|
||||
]
|
||||
for _id, codename, name in employee_permissions:
|
||||
EmployeePermission.objects.create(id=_id, codename=codename, name=name)
|
||||
|
||||
client_permissions = [
|
||||
(1, 'can_view_booking', 'Can view booking'),
|
||||
(2, 'can_manage_booking', 'Can book container'),
|
||||
(3, 'can_view_preinfo', 'Can view preinfo'),
|
||||
(4, 'can_manage_preinfo', 'Can manage preinfo'),
|
||||
(5, 'can_view_payment', 'Can view payment'),
|
||||
(6, 'can_manage_payment', 'Can manage payment'),
|
||||
(7, 'can_manage_company_users', 'Can manage company users'),
|
||||
]
|
||||
for _id, codename, name in client_permissions:
|
||||
ClientPermission.objects.create(id=_id, codename=codename, name=name)
|
||||
|
||||
|
||||
def reverse_permissions(apps, schema_editor):
|
||||
EmployeePermission = apps.get_model('accounts', 'EmployeePermission')
|
||||
ClientPermission = apps.get_model('accounts', 'ClientPermission')
|
||||
|
||||
EmployeePermission.objects.all().delete()
|
||||
ClientPermission.objects.all().delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('accounts', '0007_auto_20250725_1920'), # Adjust this to your last migration
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(create_permissions, reverse_permissions),
|
||||
]
|
||||
Reference in New Issue
Block a user