diff --git a/api/apps.py b/api/apps.py new file mode 100644 index 00000000..f2bfb744 --- /dev/null +++ b/api/apps.py @@ -0,0 +1,11 @@ +""" +Configuration of api app. +""" + +from django.apps import AppConfig + + +class ApiConfig(AppConfig): + """Configuration of api app.""" + + name = "api" \ No newline at end of file diff --git a/api/routers.py b/api/routers.py index 9703d040..6f672fe2 100644 --- a/api/routers.py +++ b/api/routers.py @@ -26,7 +26,7 @@ from collections import OrderedDict from django.conf.urls import url -from django.core.urlresolvers import NoReverseMatch +from django.urls import NoReverseMatch from rest_framework import views from rest_framework.response import Response from rest_framework.reverse import reverse diff --git a/api/urls.py b/api/urls.py index 5d06dff1..8d57b172 100644 --- a/api/urls.py +++ b/api/urls.py @@ -28,13 +28,15 @@ can also be register. That way a complete API root page presenting all URLs can be generated automatically. """ -from django.conf.urls import url, include +from django.urls import path, include from importlib import import_module from . import views from .routers import AllViewsRouter from django.conf import settings +app_name = "api" + router = AllViewsRouter() urls_viewset = [] @@ -65,4 +67,4 @@ for _url, view, name in urls_functional_view: # TOKEN AUTHENTICATION router.register_view(r"token-auth", views.ObtainExpiringAuthToken) -urlpatterns = [url(r"^", include(router.urls))] +urlpatterns = [path("", include(router.urls))] diff --git a/cotisations/apps.py b/cotisations/apps.py new file mode 100644 index 00000000..1b85f0b3 --- /dev/null +++ b/cotisations/apps.py @@ -0,0 +1,11 @@ +""" +Configuration of cotisations app. +""" + +from django.apps import AppConfig + + +class CotisationsConfig(AppConfig): + """Configuration of cotisations app.""" + + name = "cotisations" \ No newline at end of file diff --git a/cotisations/migrations/0004_auto_20210208_1827.py b/cotisations/migrations/0004_auto_20210208_1827.py new file mode 100644 index 00000000..ed7d5711 --- /dev/null +++ b/cotisations/migrations/0004_auto_20210208_1827.py @@ -0,0 +1,49 @@ +# Generated by Django 2.2.18 on 2021-02-08 17:27 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('cotisations', '0003_auto_20210124_1105'), + ] + + operations = [ + migrations.AlterModelOptions( + name='article', + options={'permissions': (('buy_every_article', 'Can buy every article'),), 'verbose_name': 'article', 'verbose_name_plural': 'articles'}, + ), + migrations.AlterModelOptions( + name='banque', + options={'verbose_name': 'bank', 'verbose_name_plural': 'banks'}, + ), + migrations.AlterModelOptions( + name='baseinvoice', + options={}, + ), + migrations.AlterModelOptions( + name='costestimate', + options={}, + ), + migrations.AlterModelOptions( + name='cotisation', + options={'permissions': (('change_all_cotisation', 'Can edit the previous subscriptions'),), 'verbose_name': 'subscription', 'verbose_name_plural': 'subscriptions'}, + ), + migrations.AlterModelOptions( + name='custominvoice', + options={}, + ), + migrations.AlterModelOptions( + name='facture', + options={'permissions': (('change_facture_control', 'Can edit the "controlled" state'), ('change_all_facture', 'Can edit all the previous invoices')), 'verbose_name': 'invoice', 'verbose_name_plural': 'invoices'}, + ), + migrations.AlterModelOptions( + name='paiement', + options={'permissions': (('use_every_payment', 'Can use every payment method'),), 'verbose_name': 'payment method', 'verbose_name_plural': 'payment methods'}, + ), + migrations.AlterModelOptions( + name='vente', + options={'permissions': (('change_all_vente', 'Can edit all the previous purchases'),), 'verbose_name': 'purchase', 'verbose_name_plural': 'purchases'}, + ), + ] diff --git a/cotisations/migrations/0015_auto_20160714_2142.py b/cotisations/migrations/0015_auto_20160714_2142.py index efb1a733..e8a52839 100644 --- a/cotisations/migrations/0015_auto_20160714_2142.py +++ b/cotisations/migrations/0015_auto_20160714_2142.py @@ -40,12 +40,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="cotisation", name="facture", - field=models.OneToOneField(to="cotisations.Facture"), + field=models.OneToOneField(to="cotisations.Facture", on_delete=models.CASCADE), ), migrations.AlterField( model_name="vente", name="facture", - field=models.ForeignKey(to="cotisations.Facture"), + field=models.ForeignKey(to="cotisations.Facture", on_delete=models.CASCADE), ), migrations.AlterField( model_name="vente", diff --git a/cotisations/migrations/0016_auto_20160715_0110.py b/cotisations/migrations/0016_auto_20160715_0110.py index e716960a..ff3701a2 100644 --- a/cotisations/migrations/0016_auto_20160715_0110.py +++ b/cotisations/migrations/0016_auto_20160715_0110.py @@ -41,7 +41,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name="cotisation", name="vente", - field=models.OneToOneField(to="cotisations.Vente", null=True), + field=models.OneToOneField(to="cotisations.Vente", null=True, on_delete=models.CASCADE), preserve_default=False, ), ] diff --git a/cotisations/models.py b/cotisations/models.py index 759f5320..c93725a4 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -62,9 +62,6 @@ class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): class Meta: abstract = False - permissions = ( - ("view_baseinvoice", _("Can view an base invoice object")), - ) # TODO : change prix to price def prix(self): @@ -157,7 +154,6 @@ class Facture(BaseInvoice): permissions = ( # TODO : change facture to invoice ("change_facture_control", _('Can edit the "controlled" state')), - ("view_facture", _("Can view an invoice object")), ("change_all_facture", _("Can edit all the previous invoices")), ) verbose_name = _("invoice") @@ -377,8 +373,6 @@ def facture_post_delete(**kwargs): class CustomInvoice(BaseInvoice): - class Meta: - permissions = (("view_custominvoice", _("Can view a custom invoice object")),) recipient = models.CharField(max_length=255, verbose_name=_("recipient")) payment = models.CharField(max_length=255, verbose_name=_("payment type")) @@ -388,8 +382,6 @@ class CustomInvoice(BaseInvoice): class CostEstimate(CustomInvoice): - class Meta: - permissions = (("view_costestimate", _("Can view a cost estimate object")),) validity = models.DurationField( verbose_name=_("period of validity"), help_text="DD HH:MM:SS" @@ -490,7 +482,6 @@ class Vente(RevMixin, AclMixin, models.Model): class Meta: permissions = ( - ("view_vente", _("Can view a purchase object")), ("change_all_vente", _("Can edit all the previous purchases")), ) verbose_name = _("purchase") @@ -750,7 +741,6 @@ class Article(RevMixin, AclMixin, models.Model): class Meta: permissions = ( - ("view_article", _("Can view an article object")), ("buy_every_article", _("Can buy every article")), ) verbose_name = "article" @@ -824,7 +814,6 @@ class Banque(RevMixin, AclMixin, models.Model): name = models.CharField(max_length=255) class Meta: - permissions = (("view_banque", _("Can view a bank object")),) verbose_name = _("bank") verbose_name_plural = _("banks") @@ -856,7 +845,6 @@ class Paiement(RevMixin, AclMixin, models.Model): class Meta: permissions = ( - ("view_paiement", _("Can view a payment method object")), ("use_every_payment", _("Can use every payment method")), ) verbose_name = _("payment method") @@ -980,7 +968,6 @@ class Cotisation(RevMixin, AclMixin, models.Model): class Meta: permissions = ( - ("view_cotisation", _("Can view a subscription object")), ("change_all_cotisation", _("Can edit the previous subscriptions")), ) verbose_name = _("subscription") diff --git a/cotisations/payment_methods/urls.py b/cotisations/payment_methods/urls.py index 9a06f497..c413fac1 100644 --- a/cotisations/payment_methods/urls.py +++ b/cotisations/payment_methods/urls.py @@ -22,7 +22,7 @@ from django.conf.urls import include, url from . import comnpay, cheque, note_kfet urlpatterns = [ - url(r"^comnpay/", include(comnpay.urls, namespace="comnpay")), - url(r"^cheque/", include(cheque.urls, namespace="cheque")), - url(r"^note_kfet/", include(note_kfet.urls, namespace="note_kfet")), + url(r"^comnpay/", include((comnpay.urls, 'comnpay'), namespace="comnpay")), + url(r"^cheque/", include((cheque.urls, 'cheque'), namespace="cheque")), + url(r"^note_kfet/", include((note_kfet.urls, 'note_kfet'), namespace="note_kfet")), ] diff --git a/cotisations/urls.py b/cotisations/urls.py index c78effa6..9967b114 100644 --- a/cotisations/urls.py +++ b/cotisations/urls.py @@ -25,85 +25,87 @@ The defined URLs for the Cotisations app from __future__ import unicode_literals -from django.conf.urls import url +from django.urls import path from . import views, views_autocomplete from . import payment_methods +app_name ="cotisations" + urlpatterns = [ - url(r"^new_facture/(?P[0-9]+)$", views.new_facture, name="new-facture"), - url( - r"^edit_facture/(?P[0-9]+)$", views.edit_facture, name="edit-facture" + path("new_facture/", views.new_facture, name="new-facture"), + path( + "edit_facture/", views.edit_facture, name="edit-facture" ), - url(r"^del_facture/(?P[0-9]+)$", views.del_facture, name="del-facture"), - url(r"^facture_pdf/(?P[0-9]+)$", views.facture_pdf, name="facture-pdf"), - url(r"^voucher_pdf/(?P[0-9]+)$", views.voucher_pdf, name="voucher-pdf"), - url(r"^new_cost_estimate/$", views.new_cost_estimate, name="new-cost-estimate"), - url( - r"^index_cost_estimate/$", views.index_cost_estimate, name="index-cost-estimate" + path("del_facture/", views.del_facture, name="del-facture"), + path("facture_pdf/", views.facture_pdf, name="facture-pdf"), + path("voucher_pdf/", views.voucher_pdf, name="voucher-pdf"), + path("new_cost_estimate", views.new_cost_estimate, name="new-cost-estimate"), + path( + "index_cost_estimate", views.index_cost_estimate, name="index-cost-estimate" ), - url( - r"^cost_estimate_pdf/(?P[0-9]+)$", + path( + "cost_estimate_pdf/", views.cost_estimate_pdf, name="cost-estimate-pdf", ), - url( - r"^index_custom_invoice/$", + path( + "index_custom_invoice", views.index_custom_invoice, name="index-custom-invoice", ), - url( - r"^edit_cost_estimate/(?P[0-9]+)$", + path( + "edit_cost_estimate/", views.edit_cost_estimate, name="edit-cost-estimate", ), - url( - r"^cost_estimate_to_invoice/(?P[0-9]+)$", + path( + "cost_estimate_to_invoice/", views.cost_estimate_to_invoice, name="cost-estimate-to-invoice", ), - url( - r"^del_cost_estimate/(?P[0-9]+)$", + path( + "del_cost_estimate/", views.del_cost_estimate, name="del-cost-estimate", ), - url(r"^new_custom_invoice/$", views.new_custom_invoice, name="new-custom-invoice"), - url( - r"^edit_custom_invoice/(?P[0-9]+)$", + path("new_custom_invoice", views.new_custom_invoice, name="new-custom-invoice"), + path( + "edit_custom_invoice/", views.edit_custom_invoice, name="edit-custom-invoice", ), - url( - r"^custom_invoice_pdf/(?P[0-9]+)$", + path( + "custom_invoice_pdf/", views.custom_invoice_pdf, name="custom-invoice-pdf", ), - url( - r"^del_custom_invoice/(?P[0-9]+)$", + path( + "del_custom_invoice/", views.del_custom_invoice, name="del-custom-invoice", ), - url(r"^credit_solde/(?P[0-9]+)$", views.credit_solde, name="credit-solde"), - url(r"^add_article/$", views.add_article, name="add-article"), - url( - r"^edit_article/(?P[0-9]+)$", views.edit_article, name="edit-article" + path("credit_solde/", views.credit_solde, name="credit-solde"), + path("add_article", views.add_article, name="add-article"), + path( + "edit_article/", views.edit_article, name="edit-article" ), - url(r"^del_article/$", views.del_article, name="del-article"), - url(r"^add_paiement/$", views.add_paiement, name="add-paiement"), - url( - r"^edit_paiement/(?P[0-9]+)$", + path("del_article", views.del_article, name="del-article"), + path("add_paiement", views.add_paiement, name="add-paiement"), + path( + "edit_paiement/", views.edit_paiement, name="edit-paiement", ), - url(r"^del_paiement/$", views.del_paiement, name="del-paiement"), - url(r"^add_banque/$", views.add_banque, name="add-banque"), - url(r"^edit_banque/(?P[0-9]+)$", views.edit_banque, name="edit-banque"), - url(r"^del_banque/$", views.del_banque, name="del-banque"), - url(r"^index_article/$", views.index_article, name="index-article"), - url(r"^index_banque/$", views.index_banque, name="index-banque"), - url(r"^index_paiement/$", views.index_paiement, name="index-paiement"), - url(r"^control/$", views.control, name="control"), - url(r"^$", views.index, name="index"), + path("del_paiement", views.del_paiement, name="del-paiement"), + path("add_banque", views.add_banque, name="add-banque"), + path("edit_banque/", views.edit_banque, name="edit-banque"), + path("del_banque", views.del_banque, name="del-banque"), + path("index_article", views.index_article, name="index-article"), + path("index_banque", views.index_banque, name="index-banque"), + path("index_paiement", views.index_paiement, name="index-paiement"), + path("control", views.control, name="control"), + path("", views.index, name="index"), ### Autocomplete Views - url(r'^banque-autocomplete/$', views_autocomplete.BanqueAutocomplete.as_view(), name='banque-autocomplete',), + path('banque-autocomplete', views_autocomplete.BanqueAutocomplete.as_view(), name='banque-autocomplete',), ] + payment_methods.urls.urlpatterns diff --git a/ldap_sync/urls.py b/ldap_sync/urls.py index 24f25ce8..b9622e85 100644 --- a/ldap_sync/urls.py +++ b/ldap_sync/urls.py @@ -1,4 +1,6 @@ -from django.conf.urls import url +from django.urls import path from .import views +app_name = "ldap_sync" + urlpatterns = [] diff --git a/logs/apps.py b/logs/apps.py new file mode 100644 index 00000000..255ad039 --- /dev/null +++ b/logs/apps.py @@ -0,0 +1,11 @@ +""" +Configuration of logs app. +""" + +from django.apps import AppConfig + + +class LogsConfig(AppConfig): + """Configuration of logs app.""" + + name = "logs" \ No newline at end of file diff --git a/logs/urls.py b/logs/urls.py index deb7ab30..d87a4efc 100644 --- a/logs/urls.py +++ b/logs/urls.py @@ -24,26 +24,28 @@ The defined URLs for the logs app. Included in re2o.urls. """ from __future__ import unicode_literals -from django.conf.urls import url +from django.urls import path from . import views +app_name = "logs" + urlpatterns = [ - url(r"^$", views.index, name="index"), - url(r"^stats_logs$", views.stats_logs, name="stats-logs"), - url( - r"^revert_action/(?P[0-9]+)$", + path("", views.index, name="index"), + path("stats_logs", views.stats_logs, name="stats-logs"), + path( + "revert_action/", views.revert_action, name="revert-action", ), - url( - r"(?P\w+)/(?P\w+)/(?P[0-9]+)$", + path( + "//", views.history, name="history", ), - url(r"^stats_general/$", views.stats_general, name="stats-general"), - url(r"^stats_models/$", views.stats_models, name="stats-models"), - url(r"^stats_users/$", views.stats_users, name="stats-users"), - url(r"^stats_actions/$", views.stats_actions, name="stats-actions"), - url(r"^stats_search_machine/$", views.stats_search_machine_history, name="stats-search-machine"), + path("stats_general", views.stats_general, name="stats-general"), + path("stats_models", views.stats_models, name="stats-models"), + path("stats_users", views.stats_users, name="stats-users"), + path("stats_actions", views.stats_actions, name="stats-actions"), + path("stats_search_machine", views.stats_search_machine_history, name="stats-search-machine"), ] diff --git a/machines/apps.py b/machines/apps.py new file mode 100644 index 00000000..4ba9970c --- /dev/null +++ b/machines/apps.py @@ -0,0 +1,11 @@ +""" +Configuration of machines app. +""" + +from django.apps import AppConfig + + +class MachinesConfig(AppConfig): + """Configuration of machines app.""" + + name = "machines" \ No newline at end of file diff --git a/machines/migrations/0001_model_creation.py b/machines/migrations/0001_model_creation.py index 96c8dffc..c8379981 100644 --- a/machines/migrations/0001_model_creation.py +++ b/machines/migrations/0001_model_creation.py @@ -1098,7 +1098,7 @@ class Migration(migrations.Migration): ( "cname", models.ForeignKey( - "self", null=True, blank=True, related_name="related_domain" + "self", null=True, blank=True, related_name="related_domain", on_delete=models.CASCADE ), ), ( diff --git a/machines/migrations/0003_auto_20210208_1827.py b/machines/migrations/0003_auto_20210208_1827.py new file mode 100644 index 00000000..ad4b8ebc --- /dev/null +++ b/machines/migrations/0003_auto_20210208_1827.py @@ -0,0 +1,108 @@ +# Generated by Django 2.2.18 on 2021-02-08 17:27 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('machines', '0002_foreign_keys'), + ] + + operations = [ + migrations.AlterModelOptions( + name='dname', + options={'verbose_name': 'DNAME record', 'verbose_name_plural': 'DNAME records'}, + ), + migrations.AlterModelOptions( + name='domain', + options={'permissions': (('change_ttl', 'Can change the TTL of a domain object'),), 'verbose_name': 'domain', 'verbose_name_plural': 'domains'}, + ), + migrations.AlterModelOptions( + name='extension', + options={'permissions': (('use_all_extension', 'Can use all extensions'),), 'verbose_name': 'DNS extension', 'verbose_name_plural': 'DNS extensions'}, + ), + migrations.AlterModelOptions( + name='interface', + options={'permissions': (('change_interface_machine', 'Can change the owner of an interface'),), 'verbose_name': 'interface', 'verbose_name_plural': 'interfaces'}, + ), + migrations.AlterModelOptions( + name='iplist', + options={'verbose_name': 'IPv4 addresses list', 'verbose_name_plural': 'IPv4 addresses lists'}, + ), + migrations.AlterModelOptions( + name='iptype', + options={'permissions': (('use_all_iptype', 'Can use all IP types'),), 'verbose_name': 'IP type', 'verbose_name_plural': 'IP types'}, + ), + migrations.AlterModelOptions( + name='ipv6list', + options={'permissions': (('change_ipv6list_slaac_ip', 'Can change the SLAAC value of an IPv6 addresses list'),), 'verbose_name': 'IPv6 addresses list', 'verbose_name_plural': 'IPv6 addresses lists'}, + ), + migrations.AlterModelOptions( + name='machine', + options={'permissions': (('change_machine_user', 'Can change the user of a machine'),), 'verbose_name': 'machine', 'verbose_name_plural': 'machines'}, + ), + migrations.AlterModelOptions( + name='machinetype', + options={'permissions': (('use_all_machinetype', 'Can use all machine types'),), 'verbose_name': 'machine type', 'verbose_name_plural': 'machine types'}, + ), + migrations.AlterModelOptions( + name='mx', + options={'verbose_name': 'MX record', 'verbose_name_plural': 'MX records'}, + ), + migrations.AlterModelOptions( + name='nas', + options={'verbose_name': 'NAS device', 'verbose_name_plural': 'NAS devices'}, + ), + migrations.AlterModelOptions( + name='ns', + options={'verbose_name': 'NS record', 'verbose_name_plural': 'NS records'}, + ), + migrations.AlterModelOptions( + name='ouvertureportlist', + options={'verbose_name': 'ports opening list', 'verbose_name_plural': 'ports opening lists'}, + ), + migrations.AlterModelOptions( + name='role', + options={'verbose_name': 'server role', 'verbose_name_plural': 'server roles'}, + ), + migrations.AlterModelOptions( + name='service', + options={'verbose_name': 'service to generate (DHCP, DNS, ...)', 'verbose_name_plural': 'services to generate (DHCP, DNS, ...)'}, + ), + migrations.AlterModelOptions( + name='service_link', + options={'verbose_name': 'link between service and server', 'verbose_name_plural': 'links between service and server'}, + ), + migrations.AlterModelOptions( + name='soa', + options={'verbose_name': 'SOA record', 'verbose_name_plural': 'SOA records'}, + ), + migrations.AlterModelOptions( + name='srv', + options={'verbose_name': 'SRV record', 'verbose_name_plural': 'SRV records'}, + ), + migrations.AlterModelOptions( + name='sshfp', + options={'verbose_name': 'SSHFP record', 'verbose_name_plural': 'SSHFP records'}, + ), + migrations.AlterModelOptions( + name='txt', + options={'verbose_name': 'TXT record', 'verbose_name_plural': 'TXT records'}, + ), + migrations.AlterModelOptions( + name='vlan', + options={'verbose_name': 'VLAN', 'verbose_name_plural': 'VLANs'}, + ), + migrations.AlterField( + model_name='domain', + name='cname', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='related_domain', to='machines.Domain'), + ), + migrations.AlterField( + model_name='iptype', + name='ouverture_ports', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.OuverturePortList'), + ), + ] diff --git a/machines/migrations/0019_auto_20160718_1141.py b/machines/migrations/0019_auto_20160718_1141.py index 23f26a00..671ca2b0 100644 --- a/machines/migrations/0019_auto_20160718_1141.py +++ b/machines/migrations/0019_auto_20160718_1141.py @@ -34,6 +34,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="interface", name="machine", - field=models.ForeignKey(to="machines.Machine"), + field=models.ForeignKey(to="machines.Machine", on_delete=models.CASCADE), ) ] diff --git a/machines/migrations/0027_alias.py b/machines/migrations/0027_alias.py index ae63c3f7..e7149481 100644 --- a/machines/migrations/0027_alias.py +++ b/machines/migrations/0027_alias.py @@ -51,7 +51,7 @@ class Migration(migrations.Migration): unique=True, ), ), - ("interface_parent", models.ForeignKey(to="machines.Interface")), + ("interface_parent", models.ForeignKey(to="machines.Interface", on_delete=models.CASCADE)), ], ) ] diff --git a/machines/migrations/0036_auto_20161224_1204.py b/machines/migrations/0036_auto_20161224_1204.py index abc7a67e..c7481ddb 100644 --- a/machines/migrations/0036_auto_20161224_1204.py +++ b/machines/migrations/0036_auto_20161224_1204.py @@ -35,7 +35,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="domain", name="interface_parent", - field=models.ForeignKey(to="machines.Interface", null=True, blank=True), + field=models.ForeignKey(to="machines.Interface", null=True, blank=True, on_delete=models.CASCADE), ), migrations.AlterUniqueTogether( name="domain", unique_together=set([("name", "extension")]) diff --git a/machines/migrations/0037_domain_cname.py b/machines/migrations/0037_domain_cname.py index be56b5c7..94c3e9fc 100644 --- a/machines/migrations/0037_domain_cname.py +++ b/machines/migrations/0037_domain_cname.py @@ -39,6 +39,7 @@ class Migration(migrations.Migration): null=True, to="machines.Domain", blank=True, + on_delete=models.CASCADE ), ) ] diff --git a/machines/migrations/0038_auto_20161224_1721.py b/machines/migrations/0038_auto_20161224_1721.py index c8515d79..1666de21 100644 --- a/machines/migrations/0038_auto_20161224_1721.py +++ b/machines/migrations/0038_auto_20161224_1721.py @@ -39,6 +39,7 @@ class Migration(migrations.Migration): to="machines.Domain", related_name="related_domain", blank=True, + on_delete=models.CASCADE, ), ) ] diff --git a/machines/migrations/0039_auto_20161224_1732.py b/machines/migrations/0039_auto_20161224_1732.py index 1ee4fb89..9a5c95c2 100644 --- a/machines/migrations/0039_auto_20161224_1732.py +++ b/machines/migrations/0039_auto_20161224_1732.py @@ -34,6 +34,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="domain", name="interface_parent", - field=models.OneToOneField(blank=True, null=True, to="machines.Interface"), + field=models.OneToOneField(blank=True, null=True, to="machines.Interface", on_delete=models.CASCADE), ) ] diff --git a/machines/models.py b/machines/models.py index cc1e64d3..8e4e494f 100644 --- a/machines/models.py +++ b/machines/models.py @@ -80,7 +80,6 @@ class Machine(RevMixin, FieldPermissionModelMixin, AclMixin, models.Model): class Meta: permissions = ( - ("view_machine", _("Can view a machine object")), ("change_machine_user", _("Can change the user of a machine")), ) verbose_name = _("machine") @@ -344,7 +343,6 @@ class MachineType(RevMixin, AclMixin, models.Model): class Meta: permissions = ( - ("view_machinetype", _("Can view a machine type object")), ("use_all_machinetype", _("Can use all machine types")), ) verbose_name = _("machine type") @@ -457,11 +455,10 @@ class IpType(RevMixin, AclMixin, models.Model): default=False, help_text=_("Enable reverse DNS for IPv6.") ) vlan = models.ForeignKey("Vlan", on_delete=models.PROTECT, blank=True, null=True) - ouverture_ports = models.ForeignKey("OuverturePortList", blank=True, null=True) + ouverture_ports = models.ForeignKey("OuverturePortList", blank=True, null=True, on_delete=models.PROTECT) class Meta: permissions = ( - ("view_iptype", _("Can view an IP type object")), ("use_all_iptype", _("Can use all IP types")), ) verbose_name = _("IP type") @@ -729,7 +726,6 @@ class Vlan(RevMixin, AclMixin, models.Model): mld = models.BooleanField(default=False, help_text=_("v6 multicast management.")) class Meta: - permissions = (("view_vlan", _("Can view a VLAN object")),) verbose_name = _("VLAN") verbose_name_plural = _("VLANs") @@ -765,7 +761,6 @@ class Nas(RevMixin, AclMixin, models.Model): autocapture_mac = models.BooleanField(default=False) class Meta: - permissions = (("view_nas", _("Can view a NAS device object")),) verbose_name = _("NAS device") verbose_name_plural = _("NAS devices") @@ -819,7 +814,6 @@ class SOA(RevMixin, AclMixin, models.Model): ) class Meta: - permissions = (("view_soa", _("Can view an SOA record object")),) verbose_name = _("SOA record") verbose_name_plural = _("SOA records") @@ -904,7 +898,6 @@ class Extension(RevMixin, AclMixin, models.Model): class Meta: permissions = ( - ("view_extension", _("Can view an extension object")), ("use_all_extension", _("Can use all extensions")), ) verbose_name = _("DNS extension") @@ -1037,7 +1030,6 @@ class Mx(RevMixin, AclMixin, models.Model): ) class Meta: - permissions = (("view_mx", _("Can view an MX record object")),) verbose_name = _("MX record") verbose_name_plural = _("MX records") @@ -1069,7 +1061,6 @@ class Ns(RevMixin, AclMixin, models.Model): ) class Meta: - permissions = (("view_ns", _("Can view an NS record object")),) verbose_name = _("NS record") verbose_name_plural = _("NS records") @@ -1101,7 +1092,6 @@ class Txt(RevMixin, AclMixin, models.Model): ) class Meta: - permissions = (("view_txt", _("Can view a TXT record object")),) verbose_name = _("TXT record") verbose_name_plural = _("TXT records") @@ -1131,7 +1121,6 @@ class DName(RevMixin, AclMixin, models.Model): ) class Meta: - permissions = (("view_dname", _("Can view a DNAME record object")),) verbose_name = _("DNAME record") verbose_name_plural = _("DNAME records") @@ -1195,7 +1184,6 @@ class Srv(RevMixin, AclMixin, models.Model): ) class Meta: - permissions = (("view_srv", _("Can view an SRV record object")),) verbose_name = _("SRV record") verbose_name_plural = _("SRV records") @@ -1285,7 +1273,6 @@ class SshFp(RevMixin, AclMixin, models.Model): } class Meta: - permissions = (("view_sshfp", _("Can view an SSHFP record object")),) verbose_name = _("SSHFP record") verbose_name_plural = _("SSHFP records") @@ -1350,7 +1337,6 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): class Meta: permissions = ( - ("view_interface", _("Can view an interface object")), ("change_interface_machine", _("Can change the owner of an interface")), ) verbose_name = _("interface") @@ -1741,7 +1727,6 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): class Meta: permissions = ( - ("view_ipv6list", _("Can view an IPv6 addresses list object")), ( "change_ipv6list_slaac_ip", _("Can change the SLAAC value of an IPv6 addresses list"), @@ -1945,7 +1930,7 @@ class Domain(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): ) extension = models.ForeignKey("Extension", on_delete=models.PROTECT) cname = models.ForeignKey( - "self", null=True, blank=True, related_name="related_domain" + "self", null=True, blank=True, related_name="related_domain", on_delete=models.PROTECT ) ttl = models.PositiveIntegerField( verbose_name=_("Time To Live (TTL)"), @@ -1956,7 +1941,6 @@ class Domain(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): class Meta: unique_together = (("name", "extension"),) permissions = ( - ("view_domain", _("Can view a domain object")), ("change_ttl", _("Can change the TTL of a domain object")), ) verbose_name = _("domain") @@ -2184,7 +2168,6 @@ class IpList(RevMixin, AclMixin, models.Model): ip_type = models.ForeignKey("IpType", on_delete=models.CASCADE) class Meta: - permissions = (("view_iplist", _("Can view an IPv4 addresses list object")),) verbose_name = _("IPv4 addresses list") verbose_name_plural = _("IPv4 addresses lists") @@ -2275,7 +2258,6 @@ class Role(RevMixin, AclMixin, models.Model): specific_role = models.CharField(choices=ROLE, null=True, blank=True, max_length=32) class Meta: - permissions = (("view_role", _("Can view a role object")),) verbose_name = _("server role") verbose_name_plural = _("server roles") @@ -2325,7 +2307,6 @@ class Service(RevMixin, AclMixin, models.Model): servers = models.ManyToManyField("Interface", through="Service_link") class Meta: - permissions = (("view_service", _("Can view a service object")),) verbose_name = _("service to generate (DHCP, DNS, ...)") verbose_name_plural = _("services to generate (DHCP, DNS, ...)") @@ -2383,9 +2364,6 @@ class Service_link(RevMixin, AclMixin, models.Model): asked_regen = models.BooleanField(default=False) class Meta: - permissions = ( - ("view_service_link", _("Can view a service server link object")), - ) verbose_name = _("link between service and server") verbose_name_plural = _("links between service and server") @@ -2438,9 +2416,6 @@ class OuverturePortList(RevMixin, AclMixin, models.Model): ) class Meta: - permissions = ( - ("view_ouvertureportlist", _("Can view a ports opening list" " object")), - ) verbose_name = _("ports opening list") verbose_name_plural = _("ports opening lists") diff --git a/machines/urls.py b/machines/urls.py index 98a6695f..94529a76 100644 --- a/machines/urls.py +++ b/machines/urls.py @@ -26,142 +26,144 @@ The defined URLs for the Machines app from __future__ import unicode_literals -from django.conf.urls import url +from django.urls import path from . import views from . import views_autocomplete +app_name = "machines" + urlpatterns = [ - url(r"^new_machine/(?P[0-9]+)$", views.new_machine, name="new-machine"), - url( - r"^edit_interface/(?P[0-9]+)$", + path("new_machine/", views.new_machine, name="new-machine"), + path( + "edit_interface/", views.edit_interface, name="edit-interface", ), - url(r"^del_machine/(?P[0-9]+)$", views.del_machine, name="del-machine"), - url( - r"^new_interface/(?P[0-9]+)$", + path("del_machine/", views.del_machine, name="del-machine"), + path( + "new_interface/", views.new_interface, name="new-interface", ), - url( - r"^del_interface/(?P[0-9]+)$", + path( + "del_interface/", views.del_interface, name="del-interface", ), - url(r"^add_machinetype/$", views.add_machinetype, name="add-machinetype"), - url( - r"^edit_machinetype/(?P[0-9]+)$", + path("add_machinetype", views.add_machinetype, name="add-machinetype"), + path( + "edit_machinetype/", views.edit_machinetype, name="edit-machinetype", ), - url(r"^del_machinetype/$", views.del_machinetype, name="del-machinetype"), - url(r"^index_machinetype/$", views.index_machinetype, name="index-machinetype"), - url(r"^add_iptype/$", views.add_iptype, name="add-iptype"), - url(r"^edit_iptype/(?P[0-9]+)$", views.edit_iptype, name="edit-iptype"), - url(r"^del_iptype/$", views.del_iptype, name="del-iptype"), - url(r"^index_iptype/$", views.index_iptype, name="index-iptype"), - url(r"^add_extension/$", views.add_extension, name="add-extension"), - url( - r"^edit_extension/(?P[0-9]+)$", + path("del_machinetype", views.del_machinetype, name="del-machinetype"), + path("index_machinetype", views.index_machinetype, name="index-machinetype"), + path("add_iptype", views.add_iptype, name="add-iptype"), + path("edit_iptype/", views.edit_iptype, name="edit-iptype"), + path("del_iptype", views.del_iptype, name="del-iptype"), + path("index_iptype", views.index_iptype, name="index-iptype"), + path("add_extension", views.add_extension, name="add-extension"), + path( + "edit_extension/", views.edit_extension, name="edit-extension", ), - url(r"^del_extension/$", views.del_extension, name="del-extension"), - url(r"^add_soa/$", views.add_soa, name="add-soa"), - url(r"^edit_soa/(?P[0-9]+)$", views.edit_soa, name="edit-soa"), - url(r"^del_soa/$", views.del_soa, name="del-soa"), - url(r"^add_mx/$", views.add_mx, name="add-mx"), - url(r"^edit_mx/(?P[0-9]+)$", views.edit_mx, name="edit-mx"), - url(r"^del_mx/$", views.del_mx, name="del-mx"), - url(r"^add_txt/$", views.add_txt, name="add-txt"), - url(r"^edit_txt/(?P[0-9]+)$", views.edit_txt, name="edit-txt"), - url(r"^del_txt/$", views.del_txt, name="del-txt"), - url(r"^add_dname/$", views.add_dname, name="add-dname"), - url(r"^edit_dname/(?P[0-9]+)$", views.edit_dname, name="edit-dname"), - url(r"^del_dname/$", views.del_dname, name="del-dname"), - url(r"^add_ns/$", views.add_ns, name="add-ns"), - url(r"^edit_ns/(?P[0-9]+)$", views.edit_ns, name="edit-ns"), - url(r"^del_ns/$", views.del_ns, name="del-ns"), - url(r"^add_srv/$", views.add_srv, name="add-srv"), - url(r"^edit_srv/(?P[0-9]+)$", views.edit_srv, name="edit-srv"), - url(r"^del_srv/$", views.del_srv, name="del-srv"), - url(r"^new_sshfp/(?P[0-9]+)$", views.new_sshfp, name="new-sshfp"), - url(r"^edit_sshfp/(?P[0-9]+)$", views.edit_sshfp, name="edit-sshfp"), - url(r"^del_sshfp/(?P[0-9]+)$", views.del_sshfp, name="del-sshfp"), - url(r"^index_sshfp/(?P[0-9]+)$", views.index_sshfp, name="index-sshfp"), - url(r"^index_extension/$", views.index_extension, name="index-extension"), - url(r"^add_alias/(?P[0-9]+)$", views.add_alias, name="add-alias"), - url(r"^edit_alias/(?P[0-9]+)$", views.edit_alias, name="edit-alias"), - url(r"^del_alias/(?P[0-9]+)$", views.del_alias, name="del-alias"), - url( - r"^index_alias/(?P[0-9]+)$", views.index_alias, name="index-alias" + path("del_extension", views.del_extension, name="del-extension"), + path("add_soa", views.add_soa, name="add-soa"), + path("edit_soa/", views.edit_soa, name="edit-soa"), + path("del_soa", views.del_soa, name="del-soa"), + path("add_mx", views.add_mx, name="add-mx"), + path("edit_mx/", views.edit_mx, name="edit-mx"), + path("del_mx", views.del_mx, name="del-mx"), + path("add_txt", views.add_txt, name="add-txt"), + path("edit_txt/", views.edit_txt, name="edit-txt"), + path("del_txt", views.del_txt, name="del-txt"), + path("add_dname", views.add_dname, name="add-dname"), + path("edit_dname/", views.edit_dname, name="edit-dname"), + path("del_dname", views.del_dname, name="del-dname"), + path("add_ns", views.add_ns, name="add-ns"), + path("edit_ns/", views.edit_ns, name="edit-ns"), + path("del_ns", views.del_ns, name="del-ns"), + path("add_srv", views.add_srv, name="add-srv"), + path("edit_srv/", views.edit_srv, name="edit-srv"), + path("del_srv", views.del_srv, name="del-srv"), + path("new_sshfp/", views.new_sshfp, name="new-sshfp"), + path("edit_sshfp/", views.edit_sshfp, name="edit-sshfp"), + path("del_sshfp/", views.del_sshfp, name="del-sshfp"), + path("index_sshfp/", views.index_sshfp, name="index-sshfp"), + path("index_extension", views.index_extension, name="index-extension"), + path("add_alias/", views.add_alias, name="add-alias"), + path("edit_alias/", views.edit_alias, name="edit-alias"), + path("del_alias/", views.del_alias, name="del-alias"), + path( + "index_alias/", views.index_alias, name="index-alias" ), - url( - r"^new_ipv6list/(?P[0-9]+)$", + path( + "new_ipv6list/", views.new_ipv6list, name="new-ipv6list", ), - url( - r"^edit_ipv6list/(?P[0-9]+)$", + path( + "edit_ipv6list/", views.edit_ipv6list, name="edit-ipv6list", ), - url( - r"^del_ipv6list/(?P[0-9]+)$", + path( + "del_ipv6list/", views.del_ipv6list, name="del-ipv6list", ), - url(r"^index_ipv6/(?P[0-9]+)$", views.index_ipv6, name="index-ipv6"), - url(r"^add_service/$", views.add_service, name="add-service"), - url( - r"^edit_service/(?P[0-9]+)$", views.edit_service, name="edit-service" + path("index_ipv6/", views.index_ipv6, name="index-ipv6"), + path("add_service", views.add_service, name="add-service"), + path( + "edit_service/", views.edit_service, name="edit-service" ), - url(r"^del_service/$", views.del_service, name="del-service"), - url( - r"^regen_service/(?P[0-9]+)$", + path("del_service", views.del_service, name="del-service"), + path( + "regen_service/", views.regen_service, name="regen-service", ), - url(r"^index_service/$", views.index_service, name="index-service"), - url(r"^add_role/$", views.add_role, name="add-role"), - url(r"^edit_role/(?P[0-9]+)$", views.edit_role, name="edit-role"), - url(r"^del_role/$", views.del_role, name="del-role"), - url(r"^index_role/$", views.index_role, name="index-role"), - url(r"^add_vlan/$", views.add_vlan, name="add-vlan"), - url(r"^edit_vlan/(?P[0-9]+)$", views.edit_vlan, name="edit-vlan"), - url(r"^del_vlan/$", views.del_vlan, name="del-vlan"), - url(r"^index_vlan/$", views.index_vlan, name="index-vlan"), - url(r"^add_nas/$", views.add_nas, name="add-nas"), - url(r"^edit_nas/(?P[0-9]+)$", views.edit_nas, name="edit-nas"), - url(r"^del_nas/$", views.del_nas, name="del-nas"), - url(r"^index_nas/$", views.index_nas, name="index-nas"), - url(r"^$", views.index, name="index"), - url(r"index_portlist/$", views.index_portlist, name="index-portlist"), - url( - r"^edit_portlist/(?P[0-9]+)$", + path("index_service", views.index_service, name="index-service"), + path("add_role", views.add_role, name="add-role"), + path("edit_role/", views.edit_role, name="edit-role"), + path("del_role", views.del_role, name="del-role"), + path("index_role", views.index_role, name="index-role"), + path("add_vlan", views.add_vlan, name="add-vlan"), + path("edit_vlan/", views.edit_vlan, name="edit-vlan"), + path("del_vlan", views.del_vlan, name="del-vlan"), + path("index_vlan", views.index_vlan, name="index-vlan"), + path("add_nas", views.add_nas, name="add-nas"), + path("edit_nas/", views.edit_nas, name="edit-nas"), + path("del_nas", views.del_nas, name="del-nas"), + path("index_nas", views.index_nas, name="index-nas"), + path("", views.index, name="index"), + path("index_portlist", views.index_portlist, name="index-portlist"), + path( + "edit_portlist/", views.edit_portlist, name="edit-portlist", ), - url( - r"^del_portlist/(?P[0-9]+)$", + path( + "del_portlist/", views.del_portlist, name="del-portlist", ), - url(r"^add_portlist/$", views.add_portlist, name="add-portlist"), - url( - r"^port_config/(?P[0-9]+)$", + path("add_portlist", views.add_portlist, name="add-portlist"), + path( + "port_config/", views.configure_ports, name="port-config", ), ### Autocomplete Views - url(r'^vlan-autocomplete/$', views_autocomplete.VlanAutocomplete.as_view(), name='vlan-autocomplete',), - url(r'^interface-autocomplete/$', views_autocomplete.InterfaceAutocomplete.as_view(), name='interface-autocomplete',), - url(r'^machine-autocomplete/$', views_autocomplete.MachineAutocomplete.as_view(), name='machine-autocomplete',), - url(r'^machinetype-autocomplete/$', views_autocomplete.MachineTypeAutocomplete.as_view(), name='machinetype-autocomplete',), - url(r'^iptype-autocomplete/$', views_autocomplete.IpTypeAutocomplete.as_view(), name='iptype-autocomplete',), - url(r'^extension-autocomplete/$', views_autocomplete.ExtensionAutocomplete.as_view(), name='extension-autocomplete',), - url(r'^domain-autocomplete/$', views_autocomplete.DomainAutocomplete.as_view(), name='domain-autocomplete',), - url(r'^ouvertureportlist-autocomplete/$', views_autocomplete.OuverturePortListAutocomplete.as_view(), name='ouvertureportlist-autocomplete',), - url(r'^iplist-autocomplete/$', views_autocomplete.IpListAutocomplete.as_view(), name='iplist-autocomplete',), + path('vlan-autocomplete', views_autocomplete.VlanAutocomplete.as_view(), name='vlan-autocomplete',), + path('interface-autocomplete', views_autocomplete.InterfaceAutocomplete.as_view(), name='interface-autocomplete',), + path('machine-autocomplete', views_autocomplete.MachineAutocomplete.as_view(), name='machine-autocomplete',), + path('machinetype-autocomplete', views_autocomplete.MachineTypeAutocomplete.as_view(), name='machinetype-autocomplete',), + path('iptype-autocomplete', views_autocomplete.IpTypeAutocomplete.as_view(), name='iptype-autocomplete',), + path('extension-autocomplete', views_autocomplete.ExtensionAutocomplete.as_view(), name='extension-autocomplete',), + path('domain-autocomplete', views_autocomplete.DomainAutocomplete.as_view(), name='domain-autocomplete',), + path('ouvertureportlist-autocomplete', views_autocomplete.OuverturePortListAutocomplete.as_view(), name='ouvertureportlist-autocomplete',), + path('iplist-autocomplete', views_autocomplete.IpListAutocomplete.as_view(), name='iplist-autocomplete',), ] diff --git a/multi_op/urls.py b/multi_op/urls.py index 3e10c882..4cae707e 100644 --- a/multi_op/urls.py +++ b/multi_op/urls.py @@ -25,35 +25,37 @@ For further details on each of those models, see the documentation details for each. """ -from django.conf.urls import url +from django.urls import path, re_path from . import views from .preferences.views import edit_options +app_name = "multi_op" + urlpatterns = [ - url(r"^$", views.aff_state_global, name="aff-state-global"), - url( - r"^(?P[0-9]+)$", + path("", views.aff_state_global, name="aff-state-global"), + path( + "", views.aff_state_dormitory, name="aff-state-dormitory", ), - url( + re_path( r"^edit_options/(?P
MultiopOption)$", edit_options, name="edit-options", ), - url( - r"^pending-connection$", + path( + "pending-connection", views.aff_pending_connection, name="aff-pending-connection", ), - url( - r"^pending-disconnection$", + path( + "pending-disconnection", views.aff_pending_disconnection, name="aff-pending-disconnection", ), - url( - r"^disconnect-room/(?P[0-9]+)$", + path( + "disconnect-room/", views.disconnect_room, name="disconnect-room", ), diff --git a/preferences/apps.py b/preferences/apps.py new file mode 100644 index 00000000..2db4b4b1 --- /dev/null +++ b/preferences/apps.py @@ -0,0 +1,11 @@ +""" +Configuration of preferences app. +""" + +from django.apps import AppConfig + + +class PreferencesConfig(AppConfig): + """Configuration of preferences app.""" + + name = "preferences" \ No newline at end of file diff --git a/preferences/migrations/0003_auto_20210208_1827.py b/preferences/migrations/0003_auto_20210208_1827.py new file mode 100644 index 00000000..207cdc56 --- /dev/null +++ b/preferences/migrations/0003_auto_20210208_1827.py @@ -0,0 +1,65 @@ +# Generated by Django 2.2.18 on 2021-02-08 17:27 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('preferences', '0002_foreign_keys'), + ] + + operations = [ + migrations.AlterModelOptions( + name='assooption', + options={'verbose_name': 'organisation preferences'}, + ), + migrations.AlterModelOptions( + name='generaloption', + options={'verbose_name': 'general preferences'}, + ), + migrations.AlterModelOptions( + name='homeoption', + options={'verbose_name': 'homepage preferences'}, + ), + migrations.AlterModelOptions( + name='mailcontact', + options={'verbose_name': 'contact email address', 'verbose_name_plural': 'contact email addresses'}, + ), + migrations.AlterModelOptions( + name='mailmessageoption', + options={'verbose_name': 'email message preferences'}, + ), + migrations.AlterModelOptions( + name='mandate', + options={'verbose_name': 'mandate', 'verbose_name_plural': 'mandates'}, + ), + migrations.AlterModelOptions( + name='optionalmachine', + options={'verbose_name': 'machine preferences'}, + ), + migrations.AlterModelOptions( + name='optionaltopologie', + options={'verbose_name': 'topology preferences'}, + ), + migrations.AlterModelOptions( + name='optionaluser', + options={'verbose_name': 'user preferences'}, + ), + migrations.AlterModelOptions( + name='radiuskey', + options={'verbose_name': 'RADIUS key', 'verbose_name_plural': 'RADIUS keys'}, + ), + migrations.AlterModelOptions( + name='reminder', + options={'verbose_name': 'reminder', 'verbose_name_plural': 'reminders'}, + ), + migrations.AlterModelOptions( + name='service', + options={'verbose_name': 'service', 'verbose_name_plural': 'services'}, + ), + migrations.AlterModelOptions( + name='switchmanagementcred', + options={'verbose_name': 'switch management credentials'}, + ), + ] diff --git a/preferences/models.py b/preferences/models.py index 4c196527..b35acac3 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -185,7 +185,6 @@ class OptionalUser(AclMixin, PreferencesModel): ) class Meta: - permissions = (("view_optionaluser", _("Can view the user preferences")),) verbose_name = _("user preferences") def clean(self): @@ -241,7 +240,6 @@ class OptionalMachine(AclMixin, PreferencesModel): return not self.get_cached_value("ipv6_mode") == "DISABLED" class Meta: - permissions = (("view_optionalmachine", _("Can view the machine preferences")),) verbose_name = _("machine preferences") @@ -421,9 +419,6 @@ class OptionalTopologie(AclMixin, PreferencesModel): ) class Meta: - permissions = ( - ("view_optionaltopologie", _("Can view the topology preferences")), - ) verbose_name = _("topology preferences") @@ -453,7 +448,6 @@ class RadiusKey(AclMixin, models.Model): ) class Meta: - permissions = (("view_radiuskey", _("Can view a RADIUS key object")),) verbose_name = _("RADIUS key") verbose_name_plural = _("RADIUS keys") @@ -483,12 +477,6 @@ class SwitchManagementCred(AclMixin, models.Model): ) class Meta: - permissions = ( - ( - "view_switchmanagementcred", - _("Can view a switch management credentials object"), - ), - ) verbose_name = _("switch management credentials") def __str__(self): @@ -518,7 +506,6 @@ class Reminder(AclMixin, models.Model): ) class Meta: - permissions = (("view_reminder", _("Can view a reminder object")),) verbose_name = _("reminder") verbose_name_plural = _("reminders") @@ -582,7 +569,6 @@ class GeneralOption(AclMixin, PreferencesModel): GTU = models.FileField(upload_to="", default="", null=True, blank=True) class Meta: - permissions = (("view_generaloption", _("Can view the general preferences")),) verbose_name = _("general preferences") @@ -609,7 +595,6 @@ class Service(AclMixin, models.Model): image = models.ImageField(upload_to="logo", blank=True) class Meta: - permissions = (("view_service", _("Can view the service preferences")),) verbose_name = _("service") verbose_name_plural = _("services") @@ -641,9 +626,6 @@ class MailContact(AclMixin, models.Model): return self.address.split("@")[0] class Meta: - permissions = ( - ("view_mailcontact", _("Can view a contact email address object")), - ) verbose_name = _("contact email address") verbose_name_plural = _("contact email addresses") @@ -664,7 +646,6 @@ class Mandate(RevMixin, AclMixin, models.Model): class Meta: verbose_name = _("mandate") verbose_name_plural = _("mandates") - permissions = (("view_mandate", _("Can view a mandate object")),) president = models.ForeignKey( "users.User", @@ -740,7 +721,6 @@ class AssoOption(AclMixin, PreferencesModel): description = models.TextField(null=True, blank=True) class Meta: - permissions = (("view_assooption", _("Can view the organisation preferences")),) verbose_name = _("organisation preferences") @@ -766,7 +746,6 @@ class HomeOption(AclMixin, PreferencesModel): twitter_account_name = models.CharField(max_length=32, null=True, blank=True) class Meta: - permissions = (("view_homeoption", _("Can view the homepage preferences")),) verbose_name = _("homepage preferences") @@ -793,9 +772,6 @@ class MailMessageOption(AclMixin, models.Model): ) class Meta: - permissions = ( - ("view_mailmessageoption", _("Can view the email message preferences")), - ) verbose_name = _("email message preferences") diff --git a/preferences/urls.py b/preferences/urls.py index c919a84c..b5b72599 100644 --- a/preferences/urls.py +++ b/preferences/urls.py @@ -25,139 +25,140 @@ Urls de l'application preferences, pointant vers les fonctions de views from __future__ import unicode_literals -from django.conf.urls import url +from django.urls import path, re_path from . import views from .views import edit_options +app_name = "preferences" urlpatterns = [ - url( + re_path( r"^edit_options/(?P
OptionalUser)$", edit_options, name="edit-options", ), - url( + re_path( r"^edit_options/(?P
OptionalMachine)$", edit_options, name="edit-options", ), - url( + re_path( r"^edit_options/(?P
OptionalTopologie)$", edit_options, name="edit-options", ), - url( + re_path( r"^edit_options/(?P
GeneralOption)$", edit_options, name="edit-options", ), - url( + re_path( r"^edit_options/(?P
AssoOption)$", edit_options, name="edit-options", ), - url( + re_path( r"^edit_options/(?P
HomeOption)$", edit_options, name="edit-options", ), - url( + re_path( r"^edit_options/(?P
MailMessageOption)$", edit_options, name="edit-options", ), - url( + re_path( r"^edit_options/(?P
RadiusOption)$", edit_options, name="edit-options", ), - url( + re_path( r"^edit_options/(?P
CotisationsOption)$", edit_options, name="edit-options", ), - url(r"^add_service/$", views.add_service, name="add-service"), - url( - r"^edit_service/(?P[0-9]+)$", views.edit_service, name="edit-service" + path("add_service", views.add_service, name="add-service"), + path( + "edit_service/", views.edit_service, name="edit-service" ), - url(r"^del_service/(?P[0-9]+)$", views.del_service, name="del-service"), - url(r"^add_mailcontact/$", views.add_mailcontact, name="add-mailcontact"), - url( - r"^edit_mailcontact/(?P[0-9]+)$", + path("del_service/", views.del_service, name="del-service"), + path("add_mailcontact", views.add_mailcontact, name="add-mailcontact"), + path( + "edit_mailcontact/", views.edit_mailcontact, name="edit-mailcontact", ), - url(r"^del_mailcontact/$", views.del_mailcontact, name="del-mailcontact"), - url(r"^add_reminder/$", views.add_reminder, name="add-reminder"), - url( - r"^edit_reminder/(?P[0-9]+)$", + path("del_mailcontact", views.del_mailcontact, name="del-mailcontact"), + path("add_reminder", views.add_reminder, name="add-reminder"), + path( + "edit_reminder/", views.edit_reminder, name="edit-reminder", ), - url( - r"^del_reminder/(?P[0-9]+)$", + path( + "del_reminder/", views.del_reminder, name="del-reminder", ), - url(r"^add_radiuskey/$", views.add_radiuskey, name="add-radiuskey"), - url( - r"^edit_radiuskey/(?P[0-9]+)$", + path("add_radiuskey", views.add_radiuskey, name="add-radiuskey"), + path( + "edit_radiuskey/", views.edit_radiuskey, name="edit-radiuskey", ), - url( - r"^del_radiuskey/(?P[0-9]+)$", + path( + "del_radiuskey/", views.del_radiuskey, name="del-radiuskey", ), - url( - r"^add_switchmanagementcred/$", + path( + "add_switchmanagementcred", views.add_switchmanagementcred, name="add-switchmanagementcred", ), - url( - r"^edit_switchmanagementcred/(?P[0-9]+)$", + path( + "edit_switchmanagementcred/", views.edit_switchmanagementcred, name="edit-switchmanagementcred", ), - url( - r"^del_switchmanagementcred/(?P[0-9]+)$", + path( + "del_switchmanagementcred/", views.del_switchmanagementcred, name="del-switchmanagementcred", ), - url( - r"^add_document_template/$", + path( + "add_document_template", views.add_document_template, name="add-document-template", ), - url( - r"^edit_document_template/(?P[0-9]+)$", + path( + "edit_document_template/", views.edit_document_template, name="edit-document-template", ), - url( - r"^del_document_template/$", + path( + "del_document_template", views.del_document_template, name="del-document-template", ), - url(r"^add_mandate/$", views.add_mandate, name="add-mandate"), - url( - r"^edit_mandate/(?P[0-9]+)$", views.edit_mandate, name="edit-mandate" + path("add_mandate", views.add_mandate, name="add-mandate"), + path( + "edit_mandate/", views.edit_mandate, name="edit-mandate" ), - url(r"^del_mandate/(?P[0-9]+)$", views.del_mandate, name="del-mandate"), - url( - r"^add_radiusattribute/$", views.add_radiusattribute, name="add-radiusattribute" + path("del_mandate/", views.del_mandate, name="del-mandate"), + path( + "add_radiusattribute", views.add_radiusattribute, name="add-radiusattribute" ), - url( - r"^edit_radiusattribute/(?P[0-9]+)$", + path( + "edit_radiusattribute/", views.edit_radiusattribute, name="edit-radiusattribute", ), - url( - r"^del_radiusattribute/(?P[0-9]+)$", + path( + "del_radiusattribute/", views.del_radiusattribute, name="del-radiusattribute", ), - url(r"^$", views.display_options, name="display-options"), + path("", views.display_options, name="display-options"), ] diff --git a/re2o/apps.py b/re2o/apps.py new file mode 100644 index 00000000..e19abee2 --- /dev/null +++ b/re2o/apps.py @@ -0,0 +1,11 @@ +""" +Configuration of re2o app. +""" + +from django.apps import AppConfig + + +class Re2oConfig(AppConfig): + """Configuration of re2o app.""" + + name = "re2o" \ No newline at end of file diff --git a/re2o/context_processors.py b/re2o/context_processors.py index 07ee1c68..0fca6037 100644 --- a/re2o/context_processors.py +++ b/re2o/context_processors.py @@ -53,7 +53,7 @@ def context_user(request): else: if global_message not in [msg.message for msg in get_messages(request._request)]: messages.warning(request._request, global_message) - if user.is_authenticated(): + if user.is_authenticated: interfaces = user.user_interfaces() else: interfaces = None diff --git a/re2o/login.py b/re2o/login.py index a997074b..0df5bf6d 100644 --- a/re2o/login.py +++ b/re2o/login.py @@ -283,9 +283,9 @@ class RecryptBackend(ModelBackend): """ - def authenticate(self, username=None, password=None): + def authenticate(self, request, username=None, password=None, **kwargs): # we obtain from the classical auth backend the user - user = super(RecryptBackend, self).authenticate(None, username, password) + user = super(RecryptBackend, self).authenticate(request, username, password, **kwargs) if user: if not (user.pwd_ntlm): # if we dont have NT hash, we create it diff --git a/re2o/settings.py b/re2o/settings.py index 612741fb..66219032 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -84,16 +84,15 @@ LOCAL_APPS = ( INSTALLED_APPS = ( EARLY_EXTERNAL_CONTRIB_APPS + DJANGO_CONTRIB_APPS + EXTERNAL_CONTRIB_APPS + LOCAL_APPS + OPTIONNAL_APPS ) -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = ( + "django.middleware.security.SecurityMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.locale.LocaleMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", - "django.contrib.auth.middleware.SessionAuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", - "django.middleware.security.SecurityMiddleware", "reversion.middleware.RevisionMiddleware", ) @@ -195,6 +194,21 @@ GRAPH_MODELS = {"all_applications": True, "group_models": True} # Timeout when sending emails through Django (in seconds) EMAIL_TIMEOUT = 10 +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + # Activate API if "api" in INSTALLED_APPS: from api.settings import * diff --git a/re2o/templatetags/acl.py b/re2o/templatetags/acl.py index 4c88b207..d8bdc310 100644 --- a/re2o/templatetags/acl.py +++ b/re2o/templatetags/acl.py @@ -382,7 +382,7 @@ class AclNode(Node): def render(self, context): resolved_args = [arg.resolve(context) for arg in self.args] - if context["user"].is_anonymous(): + if context["user"].is_anonymous: can = False else: can, _, _ = self.callback(context["user"], *(resolved_args)) @@ -407,7 +407,7 @@ class AclInstanceNode(Node): def render(self, context): callback = get_callback(self.tag_name, self.instance.resolve(context)) resolved_args = [arg.resolve(context) for arg in self.args] - if context["user"].is_anonymous(): + if context["user"].is_anonymous: can = False else: can, _, _ = callback(context["user"], *(resolved_args)) diff --git a/re2o/urls.py b/re2o/urls.py index 0942ad48..ece23894 100644 --- a/re2o/urls.py +++ b/re2o/urls.py @@ -21,67 +21,47 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -"""re2o URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/1.8/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: url(r'^$', views.home) - 3. Optional: Add a custom name for this URL: - url(r'^$', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: url(r'^$', Home.as_view()) - 3. Optional: Add a custom name for this URL: - url(r'^$', Home.as_view(), name='home') -Including another URLconf - 1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) - 2. Optional: Add a custom namespace for all URL using this urlpatterns: - url(r'^blog/', include('blog.urls'), namespace='blog') -""" from __future__ import unicode_literals from django.conf import settings -from django.conf.urls import include, url +from django.urls import include, path from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from django.views.generic import RedirectView from .settings_local import OPTIONNAL_APPS_RE2O -from .views import index, about_page, contact_page +from .views import index, about_page, contact_page, handler404, handler500 # Admin site configuration admin.site.index_title = _("Homepage") admin.site.index_template = "admin/custom_index.html" -handler500 = "re2o.views.handler500" -handler404 = "re2o.views.handler404" +handler500 = handler500 +handler404 = handler404 urlpatterns = [ - url(r"^$", index, name="index"), - url(r"^about/$", about_page, name="about"), - url(r"^contact/$", contact_page, name="contact"), - url(r"^i18n/", include("django.conf.urls.i18n")), - url(r"^users/", include("users.urls", namespace="users")), - url(r"^search/", include("search.urls", namespace="search")), - url(r"^cotisations/", include("cotisations.urls", namespace="cotisations")), - url(r"^machines/", include("machines.urls", namespace="machines")), - url(r"^topologie/", include("topologie.urls", namespace="topologie")), - url(r"^logs/", include("logs.urls", namespace="logs")), - url(r"^preferences/", include("preferences.urls", namespace="preferences")), + path("", index, name="index"), + path("about", about_page, name="about"), + path("contact", contact_page, name="contact"), + path("i18n/", include("django.conf.urls.i18n")), + path("users/", include("users.urls", namespace="users")), + path("search/", include("search.urls", namespace="search")), + path("cotisations/", include("cotisations.urls", namespace="cotisations")), + path("machines/", include("machines.urls", namespace="machines")), + path("topologie/", include("topologie.urls", namespace="topologie")), + path("logs/", include("logs.urls", namespace="logs")), + path("preferences/", include("preferences.urls", namespace="preferences")), # Include contrib auth and contrib admin # manage/login/ is redirected to the non-admin login page - url(r"^", include("django.contrib.auth.urls")), - url(r"^admin/login/$", RedirectView.as_view(pattern_name="login")), - url(r"^admin/", include(admin.site.urls)), + path("", include("django.contrib.auth.urls")), + path("admin/login/", RedirectView.as_view(pattern_name="login")), + path("admin/", admin.site.urls), ] urlpatterns += [ - url(r"^{}/".format(app), include("{}.urls".format(app), namespace=app)) + path("{}/".format(app), include("{}.urls".format(app), namespace=app)) for app in OPTIONNAL_APPS_RE2O ] @@ -89,6 +69,6 @@ urlpatterns += [ if "debug_toolbar" in settings.INSTALLED_APPS: import debug_toolbar - urlpatterns += [url(r"^__debug__/", include(debug_toolbar.urls))] + urlpatterns += [path("__debug__/", include(debug_toolbar.urls))] if "api" in settings.INSTALLED_APPS: - urlpatterns += [url(r"^api/", include("api.urls", namespace="api"))] + urlpatterns += [path("api/", include("api.urls", namespace="api"))] diff --git a/re2o/views.py b/re2o/views.py index bf08009a..f9bcb322 100644 --- a/re2o/views.py +++ b/re2o/views.py @@ -168,7 +168,7 @@ def handler500(request): return render(request, "errors/500.html", status=500) -def handler404(request): +def handler404(request, exception): """The handler view for a 404 error""" return render(request, "errors/404.html", status=404) diff --git a/search/apps.py b/search/apps.py new file mode 100644 index 00000000..1dad5588 --- /dev/null +++ b/search/apps.py @@ -0,0 +1,11 @@ +""" +Configuration of search app. +""" + +from django.apps import AppConfig + + +class SearchConfig(AppConfig): + """Configuration of search app.""" + + name = "search" \ No newline at end of file diff --git a/search/urls.py b/search/urls.py index 72778cfd..c39c00cc 100644 --- a/search/urls.py +++ b/search/urls.py @@ -24,11 +24,13 @@ from __future__ import unicode_literals -from django.conf.urls import url +from django.urls import path from . import views +app_name = "search" + urlpatterns = [ - url(r"^$", views.search, name="search"), - url(r"^advanced/$", views.searchp, name="searchp"), + path("", views.search, name="search"), + path("advanced", views.searchp, name="searchp"), ] diff --git a/tickets/urls.py b/tickets/urls.py index 1fcab4c5..c853fcfc 100644 --- a/tickets/urls.py +++ b/tickets/urls.py @@ -23,23 +23,25 @@ Tickets url """ -from django.conf.urls import url +from django.urls import path, re_path from . import views from .preferences.views import edit_options +app_name = "tickets" + urlpatterns = [ - url(r"^$", views.aff_tickets, name="aff-tickets"), - url(r"^(?P[0-9]+)$", views.aff_ticket, name="aff-ticket"), - url(r"^change_ticket_status/(?P[0-9]+)$", views.change_ticket_status, name="change-ticket-status"), - url(r"^edit_ticket/(?P[0-9]+)$", views.edit_ticket, name="edit-ticket"), - url( + path("", views.aff_tickets, name="aff-tickets"), + path("", views.aff_ticket, name="aff-ticket"), + path("change_ticket_status/", views.change_ticket_status, name="change-ticket-status"), + path("edit_ticket/", views.edit_ticket, name="edit-ticket"), + re_path( r"^edit_options/(?P
TicketOption)$", edit_options, name="edit-options", ), - url(r"^new_ticket/$", views.new_ticket, name="new-ticket"), - url(r"^add_comment/(?P[0-9]+)$", views.add_comment, name="add-comment"), - url(r"^edit_comment/(?P[0-9]+)$", views.edit_comment, name="edit-comment"), - url(r"^del_comment/(?P[0-9]+)$", views.del_comment, name="del-comment"), + path("new_ticket", views.new_ticket, name="new-ticket"), + path("add_comment/", views.add_comment, name="add-comment"), + path("edit_comment/", views.edit_comment, name="edit-comment"), + path("del_comment/", views.del_comment, name="del-comment"), ] diff --git a/topologie/apps.py b/topologie/apps.py new file mode 100644 index 00000000..df131bc0 --- /dev/null +++ b/topologie/apps.py @@ -0,0 +1,11 @@ +""" +Configuration of topologie app. +""" + +from django.apps import AppConfig + + +class TopologieConfig(AppConfig): + """Configuration of topologie app.""" + + name = "topologie" \ No newline at end of file diff --git a/topologie/migrations/0002_auto_20160703_1118.py b/topologie/migrations/0002_auto_20160703_1118.py index 8f5bf6a0..580d184a 100644 --- a/topologie/migrations/0002_auto_20160703_1118.py +++ b/topologie/migrations/0002_auto_20160703_1118.py @@ -52,12 +52,12 @@ class Migration(migrations.Migration): ( "_content_type", models.ForeignKey( - null=True, blank=True, to="contenttypes.ContentType" + null=True, blank=True, to="contenttypes.ContentType", on_delete=models.CASCADE ), ), ( "switch", - models.ForeignKey(related_name="ports", to="topologie.Switch"), + models.ForeignKey(related_name="ports", to="topologie.Switch", on_delete=models.CASCADE), ), ], ), diff --git a/topologie/migrations/0003_auto_20210208_1827.py b/topologie/migrations/0003_auto_20210208_1827.py new file mode 100644 index 00000000..3f4c4b6a --- /dev/null +++ b/topologie/migrations/0003_auto_20210208_1827.py @@ -0,0 +1,71 @@ +# Generated by Django 2.2.18 on 2021-02-08 17:27 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('topologie', '0002_foreign_keys'), + ] + + operations = [ + migrations.AlterModelOptions( + name='accesspoint', + options={'verbose_name': 'access point', 'verbose_name_plural': 'access points'}, + ), + migrations.AlterModelOptions( + name='building', + options={'verbose_name': 'building', 'verbose_name_plural': 'buildings'}, + ), + migrations.AlterModelOptions( + name='constructorswitch', + options={'verbose_name': 'switch constructor', 'verbose_name_plural': 'switch constructors'}, + ), + migrations.AlterModelOptions( + name='dormitory', + options={'verbose_name': 'dormitory', 'verbose_name_plural': 'dormitories'}, + ), + migrations.AlterModelOptions( + name='modelswitch', + options={'verbose_name': 'switch model', 'verbose_name_plural': 'switch models'}, + ), + migrations.AlterModelOptions( + name='moduleonswitch', + options={'verbose_name': 'link between switch and module', 'verbose_name_plural': 'links between switch and module'}, + ), + migrations.AlterModelOptions( + name='moduleswitch', + options={'verbose_name': 'switch module', 'verbose_name_plural': 'switch modules'}, + ), + migrations.AlterModelOptions( + name='port', + options={'verbose_name': 'port', 'verbose_name_plural': 'ports'}, + ), + migrations.AlterModelOptions( + name='portprofile', + options={'verbose_name': 'port profile', 'verbose_name_plural': 'port profiles'}, + ), + migrations.AlterModelOptions( + name='room', + options={'ordering': ['building__name'], 'verbose_name': 'room', 'verbose_name_plural': 'rooms'}, + ), + migrations.AlterModelOptions( + name='stack', + options={'verbose_name': 'switches stack', 'verbose_name_plural': 'switches stacks'}, + ), + migrations.AlterModelOptions( + name='switch', + options={'verbose_name': 'switch', 'verbose_name_plural': 'switches'}, + ), + migrations.AlterModelOptions( + name='switchbay', + options={'verbose_name': 'switch bay', 'verbose_name_plural': 'switch bays'}, + ), + migrations.AlterField( + model_name='port', + name='related', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='related_port', to='topologie.Port'), + ), + ] diff --git a/topologie/migrations/0013_port_related.py b/topologie/migrations/0013_port_related.py index decbeca9..08b0643d 100644 --- a/topologie/migrations/0013_port_related.py +++ b/topologie/migrations/0013_port_related.py @@ -35,7 +35,7 @@ class Migration(migrations.Migration): model_name="port", name="related", field=models.OneToOneField( - null=True, to="topologie.Port", blank=True, related_name="related_port" + null=True, to="topologie.Port", blank=True, related_name="related_port", on_delete=models.CASCADE ), ) ] diff --git a/topologie/migrations/0016_auto_20160706_1531.py b/topologie/migrations/0016_auto_20160706_1531.py index 3298e753..fa69dd68 100644 --- a/topologie/migrations/0016_auto_20160706_1531.py +++ b/topologie/migrations/0016_auto_20160706_1531.py @@ -36,7 +36,7 @@ class Migration(migrations.Migration): model_name="port", name="related", field=models.OneToOneField( - blank=True, to="topologie.Port", related_name="related_port", null=True + blank=True, to="topologie.Port", related_name="related_port", null=True, on_delete=models.CASCADE ), ), ] diff --git a/topologie/migrations/0019_auto_20161026_1348.py b/topologie/migrations/0019_auto_20161026_1348.py index 310629fc..8bcdae8d 100644 --- a/topologie/migrations/0019_auto_20161026_1348.py +++ b/topologie/migrations/0019_auto_20161026_1348.py @@ -43,7 +43,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name="switch", name="switch_interface", - field=models.OneToOneField(default=1, to="machines.Interface"), + field=models.OneToOneField(default=1, to="machines.Interface", on_delete=models.CASCADE), preserve_default=False, ), migrations.AlterUniqueTogether(name="switch", unique_together=set([])), diff --git a/topologie/models.py b/topologie/models.py index faecf380..b0d78249 100644 --- a/topologie/models.py +++ b/topologie/models.py @@ -70,7 +70,6 @@ class Stack(AclMixin, RevMixin, models.Model): member_id_max = models.PositiveIntegerField() class Meta: - permissions = (("view_stack", _("Can view a stack object")),) verbose_name = _("switches stack") verbose_name_plural = _("switches stacks") @@ -106,7 +105,6 @@ class AccessPoint(Machine): ) class Meta: - permissions = (("view_accesspoint", _("Can view an access point object")),) verbose_name = _("access point") verbose_name_plural = _("access points") @@ -282,7 +280,6 @@ class Switch(Machine): class Meta: unique_together = ("stack", "stack_member_id") - permissions = (("view_switch", _("Can view a switch object")),) verbose_name = _("switch") verbose_name_plural = _("switches") @@ -590,7 +587,6 @@ class ModelSwitch(AclMixin, RevMixin, models.Model): ) class Meta: - permissions = (("view_modelswitch", _("Can view a switch model object")),) verbose_name = _("switch model") verbose_name_plural = _("switch models") @@ -623,7 +619,6 @@ class ModuleSwitch(AclMixin, RevMixin, models.Model): ) class Meta: - permissions = (("view_moduleswitch", _("Can view a switch module object")),) verbose_name = _("switch module") verbose_name_plural = _("switch modules") @@ -647,12 +642,6 @@ class ModuleOnSwitch(AclMixin, RevMixin, models.Model): ) class Meta: - permissions = ( - ( - "view_moduleonswitch", - _("Can view a link between switch and module object"), - ), - ) verbose_name = _("link between switch and module") verbose_name_plural = _("links between switch and module") unique_together = ["slot", "switch"] @@ -673,9 +662,6 @@ class ConstructorSwitch(AclMixin, RevMixin, models.Model): name = models.CharField(max_length=255) class Meta: - permissions = ( - ("view_constructorswitch", _("Can view a switch constructor object")), - ) verbose_name = _("switch constructor") verbose_name_plural = _("switch constructors") @@ -697,7 +683,6 @@ class SwitchBay(AclMixin, RevMixin, models.Model): info = models.CharField(max_length=255, blank=True, null=True) class Meta: - permissions = (("view_switchbay", _("Can view a switch bay object")),) verbose_name = _("switch bay") verbose_name_plural = _("switch bays") @@ -715,7 +700,6 @@ class Dormitory(AclMixin, RevMixin, models.Model): name = models.CharField(max_length=255) class Meta: - permissions = (("view_dormitory", _("Can view a dormitory object")),) verbose_name = _("dormitory") verbose_name_plural = _("dormitories") @@ -764,7 +748,6 @@ class Building(AclMixin, RevMixin, models.Model): dormitory = models.ForeignKey("Dormitory", on_delete=models.PROTECT) class Meta: - permissions = (("view_building", _("Can view a building object")),) verbose_name = _("building") verbose_name_plural = _("buildings") @@ -837,7 +820,7 @@ class Port(AclMixin, RevMixin, models.Model): "machines.Interface", on_delete=models.SET_NULL, blank=True, null=True ) related = models.OneToOneField( - "self", null=True, blank=True, related_name="related_port" + "self", null=True, blank=True, related_name="related_port", on_delete=models.SET_NULL ) custom_profile = models.ForeignKey( "PortProfile", on_delete=models.PROTECT, blank=True, null=True @@ -851,7 +834,6 @@ class Port(AclMixin, RevMixin, models.Model): class Meta: unique_together = ("switch", "port") - permissions = (("view_port", _("Can view a port object")),) verbose_name = _("port") verbose_name_plural = _("ports") @@ -971,7 +953,6 @@ class Room(AclMixin, RevMixin, models.Model): class Meta: ordering = ["building__name"] - permissions = (("view_room", _("Can view a room object")),) verbose_name = _("room") verbose_name_plural = _("rooms") unique_together = ("name", "building") @@ -1121,7 +1102,6 @@ class PortProfile(AclMixin, RevMixin, models.Model): ) class Meta: - permissions = (("view_portprofile", _("Can view a port profile object")),) verbose_name = _("port profile") verbose_name_plural = _("port profiles") unique_together = ["on_dormitory", "profil_default"] diff --git a/topologie/urls.py b/topologie/urls.py index 05688fd3..6e5640ee 100644 --- a/topologie/urls.py +++ b/topologie/urls.py @@ -25,157 +25,159 @@ The defined URLs for topologie app. Included in re2o.urls. from __future__ import unicode_literals -from django.conf.urls import url +from django.urls import path from . import views from . import views_autocomplete +app_name = "topologie" + urlpatterns = [ - url(r"^$", views.index, name="index"), - url(r"^index_ap/$", views.index_ap, name="index-ap"), - url(r"^new_ap/$", views.new_ap, name="new-ap"), - url(r"^edit_ap/(?P[0-9]+)$", views.edit_ap, name="edit-ap"), - url( - r"^create_ports/(?P[0-9]+)$", views.create_ports, name="create-ports" + path("", views.index, name="index"), + path("index_ap", views.index_ap, name="index-ap"), + path("new_ap", views.new_ap, name="new-ap"), + path("edit_ap/", views.edit_ap, name="edit-ap"), + path( + "create_ports/", views.create_ports, name="create-ports" ), - url(r"^index_room/$", views.index_room, name="index-room"), - url(r"^new_room/$", views.new_room, name="new-room"), - url(r"^edit_room/(?P[0-9]+)$", views.edit_room, name="edit-room"), - url(r"^del_room/(?P[0-9]+)$", views.del_room, name="del-room"), - url(r"^new_switch/$", views.new_switch, name="new-switch"), - url(r"^switch/(?P[0-9]+)$", views.index_port, name="index-port"), - url(r"^edit_port/(?P[0-9]+)$", views.edit_port, name="edit-port"), - url(r"^new_port/(?P[0-9]+)$", views.new_port, name="new-port"), - url(r"^del_port/(?P[0-9]+)$", views.del_port, name="del-port"), - url(r"^edit_switch/(?P[0-9]+)$", views.edit_switch, name="edit-switch"), - url(r"^new_stack/$", views.new_stack, name="new-stack"), - url( - r"^index_stack/$", + path("index_room", views.index_room, name="index-room"), + path("new_room", views.new_room, name="new-room"), + path("edit_room/", views.edit_room, name="edit-room"), + path("del_room/", views.del_room, name="del-room"), + path("new_switch", views.new_switch, name="new-switch"), + path("switch/", views.index_port, name="index-port"), + path("edit_port/", views.edit_port, name="edit-port"), + path("new_port/", views.new_port, name="new-port"), + path("del_port/", views.del_port, name="del-port"), + path("edit_switch/", views.edit_switch, name="edit-switch"), + path("new_stack", views.new_stack, name="new-stack"), + path( + "index_stack", views.index_stack, name="index-stack", ), - url( - r"^index_switch_bay/$", + path( + "index_switch_bay", views.index_switch_bay, name="index-switch-bay", ), - url( - r"^index_building/$", + path( + "index_building", views.index_building, name="index-building", ), - url( - r"^index_dormitory/$", + path( + "index_dormitory", views.index_dormitory, name="index-dormitory", ), - url(r"^edit_stack/(?P[0-9]+)$", views.edit_stack, name="edit-stack"), - url(r"^del_stack/(?P[0-9]+)$", views.del_stack, name="del-stack"), - url(r"^index_model_switch/$", views.index_model_switch, name="index-model-switch"), - url(r"^index_model_switch/$", views.index_model_switch, name="index-model-switch"), - url(r"^new_model_switch/$", views.new_model_switch, name="new-model-switch"), - url( - r"^edit_model_switch/(?P[0-9]+)$", + path("edit_stack/", views.edit_stack, name="edit-stack"), + path("del_stack/", views.del_stack, name="del-stack"), + path("index_model_switch", views.index_model_switch, name="index-model-switch"), + path("index_model_switch", views.index_model_switch, name="index-model-switch"), + path("new_model_switch", views.new_model_switch, name="new-model-switch"), + path( + "edit_model_switch/", views.edit_model_switch, name="edit-model-switch", ), - url( - r"^del_model_switch/(?P[0-9]+)$", + path( + "del_model_switch/", views.del_model_switch, name="del-model-switch", ), - url( - r"^new_constructor_switch/$", + path( + "new_constructor_switch", views.new_constructor_switch, name="new-constructor-switch", ), - url( - r"^edit_constructor_switch/(?P[0-9]+)$", + path( + "edit_constructor_switch/", views.edit_constructor_switch, name="edit-constructor-switch", ), - url( - r"^del_constructor_switch/(?P[0-9]+)$", + path( + "del_constructor_switch/", views.del_constructor_switch, name="del-constructor-switch", ), - url(r"^new_switch_bay/$", views.new_switch_bay, name="new-switch-bay"), - url( - r"^edit_switch_bay/(?P[0-9]+)$", + path("new_switch_bay", views.new_switch_bay, name="new-switch-bay"), + path( + "edit_switch_bay/", views.edit_switch_bay, name="edit-switch-bay", ), - url( - r"^del_switch_bay/(?P[0-9]+)$", + path( + "del_switch_bay/", views.del_switch_bay, name="del-switch-bay", ), - url(r"^new_building/$", views.new_building, name="new-building"), - url( - r"^edit_building/(?P[0-9]+)$", + path("new_building", views.new_building, name="new-building"), + path( + "edit_building/", views.edit_building, name="edit-building", ), - url( - r"^del_building/(?P[0-9]+)$", + path( + "del_building/", views.del_building, name="del-building", ), - url(r"^new_dormitory/$", views.new_dormitory, name="new-dormitory"), - url( - r"^edit_dormitory/(?P[0-9]+)$", + path("new_dormitory", views.new_dormitory, name="new-dormitory"), + path( + "edit_dormitory/", views.edit_dormitory, name="edit-dormitory", ), - url( - r"^del_dormitory/(?P[0-9]+)$", + path( + "del_dormitory/", views.del_dormitory, name="del-dormitory", ), - url(r"^index_port_profile/$", views.index_port_profile, name="index-port-profile"), - url(r"^new_port_profile/$", views.new_port_profile, name="new-port-profile"), - url( - r"^edit_port_profile/(?P[0-9]+)$", + path("index_port_profile", views.index_port_profile, name="index-port-profile"), + path("new_port_profile", views.new_port_profile, name="new-port-profile"), + path( + "edit_port_profile/", views.edit_port_profile, name="edit-port-profile", ), - url( - r"^del_port_profile/(?P[0-9]+)$", + path( + "del_port_profile/", views.del_port_profile, name="del-port-profile", ), - url( - r"^edit_vlanoptions/(?P[0-9]+)$", + path( + "edit_vlanoptions/", views.edit_vlanoptions, name="edit-vlanoptions", ), - url(r"^add_module/$", views.add_module, name="add-module"), - url( - r"^edit_module/(?P[0-9]+)$", + path("add_module", views.add_module, name="add-module"), + path( + "edit_module/", views.edit_module, name="edit-module", ), - url( - r"^del_module/(?P[0-9]+)$", views.del_module, name="del-module" + path( + "del_module/", views.del_module, name="del-module" ), - url(r"^index_module/$", views.index_module, name="index-module"), - url(r"^add_module_on/$", views.add_module_on, name="add-module-on"), - url( - r"^edit_module_on/(?P[0-9]+)$", + path("index_module", views.index_module, name="index-module"), + path("add_module_on", views.add_module_on, name="add-module-on"), + path( + "edit_module_on/", views.edit_module_on, name="edit-module-on", ), - url( - r"^del_module_on/(?P[0-9]+)$", + path( + "del_module_on/", views.del_module_on, name="del-module-on", ), ### Autocomplete Views - url(r'^room-autocomplete/$', views_autocomplete.RoomAutocomplete.as_view(), name='room-autocomplete',), - url(r'^building-autocomplete/$', views_autocomplete.BuildingAutocomplete.as_view(), name='building-autocomplete',), - url(r'^dormitory-autocomplete/$', views_autocomplete.DormitoryAutocomplete.as_view(), name='dormitory-autocomplete',), - url(r'^switch-autocomplete/$', views_autocomplete.SwitchAutocomplete.as_view(), name='switch-autocomplete',), - url(r'^port-autocomplete/$', views_autocomplete.PortAutocomplete.as_view(), name='profile-autocomplete',), - url(r'^portprofile-autocomplete/$', views_autocomplete.PortProfileAutocomplete.as_view(), name='portprofile-autocomplete',), - url(r'^switchbay-autocomplete/$', views_autocomplete.SwitchBayAutocomplete.as_view(), name='switchbay-autocomplete',), + path('room-autocomplete', views_autocomplete.RoomAutocomplete.as_view(), name='room-autocomplete',), + path('building-autocomplete', views_autocomplete.BuildingAutocomplete.as_view(), name='building-autocomplete',), + path('dormitory-autocomplete', views_autocomplete.DormitoryAutocomplete.as_view(), name='dormitory-autocomplete',), + path('switch-autocomplete', views_autocomplete.SwitchAutocomplete.as_view(), name='switch-autocomplete',), + path('port-autocomplete', views_autocomplete.PortAutocomplete.as_view(), name='profile-autocomplete',), + path('portprofile-autocomplete', views_autocomplete.PortProfileAutocomplete.as_view(), name='portprofile-autocomplete',), + path('switchbay-autocomplete', views_autocomplete.SwitchBayAutocomplete.as_view(), name='switchbay-autocomplete',), ] diff --git a/users/apps.py b/users/apps.py new file mode 100644 index 00000000..626c66e5 --- /dev/null +++ b/users/apps.py @@ -0,0 +1,11 @@ +""" +Configuration of users app. +""" + +from django.apps import AppConfig + + +class CoreConfig(AppConfig): + """Configuration of users app.""" + + name = "users" \ No newline at end of file diff --git a/users/migrations/0003_auto_20210208_1827.py b/users/migrations/0003_auto_20210208_1827.py new file mode 100644 index 00000000..ba04ab0b --- /dev/null +++ b/users/migrations/0003_auto_20210208_1827.py @@ -0,0 +1,52 @@ +# Generated by Django 2.2.18 on 2021-02-08 17:27 + +import django.contrib.auth.models +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0002_foreign_keys'), + ] + + operations = [ + migrations.AlterModelOptions( + name='ban', + options={'verbose_name': 'ban', 'verbose_name_plural': 'bans'}, + ), + migrations.AlterModelOptions( + name='emailaddress', + options={'verbose_name': 'local email account', 'verbose_name_plural': 'local email accounts'}, + ), + migrations.AlterModelOptions( + name='listright', + options={'verbose_name': 'group of rights', 'verbose_name_plural': 'groups of rights'}, + ), + migrations.AlterModelOptions( + name='listshell', + options={'verbose_name': 'shell', 'verbose_name_plural': 'shells'}, + ), + migrations.AlterModelOptions( + name='school', + options={'verbose_name': 'school', 'verbose_name_plural': 'schools'}, + ), + migrations.AlterModelOptions( + name='serviceuser', + options={'verbose_name': 'service user', 'verbose_name_plural': 'service users'}, + ), + migrations.AlterModelOptions( + name='user', + options={'permissions': (('change_user_password', 'Can change the password of a user'), ('change_user_state', 'Can edit the state of a user'), ('change_user_force', 'Can force the move'), ('change_user_shell', 'Can edit the shell of a user'), ('change_user_pseudo', 'Can edit the pseudo of a user'), ('change_user_groups', 'Can edit the groups of rights of a user (critical permission)'), ('change_all_users', 'Can edit all users, including those with rights')), 'verbose_name': 'user (member or club)', 'verbose_name_plural': 'users (members or clubs)'}, + ), + migrations.AlterModelOptions( + name='whitelist', + options={'verbose_name': 'whitelist (free of charge access)', 'verbose_name_plural': 'whitelists (free of charge access)'}, + ), + migrations.AlterModelManagers( + name='listright', + managers=[ + ('objects', django.contrib.auth.models.GroupManager()), + ], + ), + ] diff --git a/users/models.py b/users/models.py index befcd8bc..5256d7c5 100755 --- a/users/models.py +++ b/users/models.py @@ -57,7 +57,7 @@ from django.db.models.signals import post_save, post_delete, m2m_changed from django.dispatch import receiver from django.utils.functional import cached_property from django.template import loader -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db import transaction from django.utils import timezone from datetime import timedelta @@ -319,7 +319,6 @@ class User( _("Can edit the groups of rights of a user (critical permission)"), ), ("change_all_users", _("Can edit all users, including those with rights")), - ("view_user", _("Can view a user object")), ) verbose_name = _("user (member or club)") verbose_name_plural = _("users (members or clubs)") @@ -2161,7 +2160,6 @@ class ServiceUser(RevMixin, AclMixin, AbstractBaseUser): objects = UserManager() class Meta: - permissions = (("view_serviceuser", _("Can view a service user object")),) verbose_name = _("service user") verbose_name_plural = _("service users") @@ -2218,7 +2216,6 @@ class School(RevMixin, AclMixin, models.Model): name = models.CharField(max_length=255) class Meta: - permissions = (("view_school", _("Can view a school object")),) verbose_name = _("school") verbose_name_plural = _("schools") @@ -2272,7 +2269,6 @@ class ListRight(RevMixin, AclMixin, Group): details = models.CharField(help_text=_("Description."), max_length=255, blank=True) class Meta: - permissions = (("view_listright", _("Can view a group of rights object")),) verbose_name = _("group of rights") verbose_name_plural = _("groups of rights") @@ -2312,7 +2308,6 @@ class ListShell(RevMixin, AclMixin, models.Model): shell = models.CharField(max_length=255, unique=True) class Meta: - permissions = (("view_listshell", _("Can view a shell object")),) verbose_name = _("shell") verbose_name_plural = _("shells") @@ -2378,7 +2373,6 @@ class Ban(RevMixin, AclMixin, models.Model): request = None class Meta: - permissions = (("view_ban", _("Can view a ban object")),) verbose_name = _("ban") verbose_name_plural = _("bans") @@ -2495,7 +2489,6 @@ class Whitelist(RevMixin, AclMixin, models.Model): date_end = models.DateTimeField() class Meta: - permissions = (("view_whitelist", _("Can view a whitelist object")),) verbose_name = _("whitelist (free of charge access)") verbose_name_plural = _("whitelists (free of charge access)") @@ -2617,9 +2610,6 @@ class EMailAddress(RevMixin, AclMixin, models.Model): ) class Meta: - permissions = ( - ("view_emailaddress", _("Can view a local email account object")), - ) verbose_name = _("local email account") verbose_name_plural = _("local email accounts") diff --git a/users/urls.py b/users/urls.py index b7d52ddc..3dc1d5d8 100644 --- a/users/urls.py +++ b/users/urls.py @@ -28,111 +28,113 @@ The defined URLs for the Users app from __future__ import unicode_literals -from django.conf.urls import url +from django.urls import path, re_path from . import views from . import views_autocomplete +app_name = "users" + urlpatterns = [ - url(r"^new_user/$", views.new_user, name="new-user"), - url(r"^new_club/$", views.new_club, name="new-club"), - url(r"^edit_info/(?P[0-9]+)$", views.edit_info, name="edit-info"), - url( - r"^edit_club_admin_members/(?P[0-9]+)$", + path("new_user", views.new_user, name="new-user"), + path("new_club", views.new_club, name="new-club"), + path("edit_info/", views.edit_info, name="edit-info"), + path( + "edit_club_admin_members/", views.edit_club_admin_members, name="edit-club-admin-members", ), - url(r"^state/(?P[0-9]+)$", views.state, name="state"), - url(r"^groups/(?P[0-9]+)$", views.groups, name="groups"), - url(r"^password/(?P[0-9]+)$", views.password, name="password"), - url(r"^confirm_email/(?P[0-9]+)$", views.resend_confirmation_email, name="resend-confirmation-email"), - url( - r"^del_group/(?P[0-9]+)/(?P[0-9]+)$", + path("state/", views.state, name="state"), + path("groups/", views.groups, name="groups"), + path("password/", views.password, name="password"), + path("confirm_email/", views.resend_confirmation_email, name="resend-confirmation-email"), + path( + "del_group//", views.del_group, name="del-group", ), - url( - r"^del_superuser/(?P[0-9]+)$", views.del_superuser, name="del-superuser" + path( + "del_superuser/", views.del_superuser, name="del-superuser" ), - url(r"^new_serviceuser/$", views.new_serviceuser, name="new-serviceuser"), - url( - r"^edit_serviceuser/(?P[0-9]+)$", + path("new_serviceuser", views.new_serviceuser, name="new-serviceuser"), + path( + "edit_serviceuser/", views.edit_serviceuser, name="edit-serviceuser", ), - url( - r"^del_serviceuser/(?P[0-9]+)$", + path( + "del_serviceuser/", views.del_serviceuser, name="del-serviceuser", ), - url(r"^add_ban/(?P[0-9]+)$", views.add_ban, name="add-ban"), - url(r"^edit_ban/(?P[0-9]+)$", views.edit_ban, name="edit-ban"), - url(r"^del-ban/(?P[0-9]+)$", views.del_ban, name="del-ban"), - url( - r"^add_whitelist/(?P[0-9]+)$", views.add_whitelist, name="add-whitelist" + path("add_ban/", views.add_ban, name="add-ban"), + path("edit_ban/", views.edit_ban, name="edit-ban"), + path("del-ban/", views.del_ban, name="del-ban"), + path( + "add_whitelist/", views.add_whitelist, name="add-whitelist" ), - url( - r"^edit_whitelist/(?P[0-9]+)$", + path( + "edit_whitelist/", views.edit_whitelist, name="edit-whitelist", ), - url( - r"^del_whitelist/(?P[0-9]+)$", + path( + "del_whitelist/", views.del_whitelist, name="del-whitelist", ), - url( - r"^add_emailaddress/(?P[0-9]+)$", + path( + "add_emailaddress/", views.add_emailaddress, name="add-emailaddress", ), - url( - r"^edit_emailaddress/(?P[0-9]+)$", + path( + "edit_emailaddress/", views.edit_emailaddress, name="edit-emailaddress", ), - url( - r"^del_emailaddress/(?P[0-9]+)$", + path( + "del_emailaddress/", views.del_emailaddress, name="del-emailaddress", ), - url( - r"^edit_email_settings/(?P[0-9]+)$", + path( + "edit_email_settings/", views.edit_email_settings, name="edit-email-settings", ), - url(r"^add_school/$", views.add_school, name="add-school"), - url(r"^edit_school/(?P[0-9]+)$", views.edit_school, name="edit-school"), - url(r"^del_school/$", views.del_school, name="del-school"), - url(r"^add_listright/$", views.add_listright, name="add-listright"), - url( - r"^edit_listright/(?P[0-9]+)$", + path("add_school", views.add_school, name="add-school"), + path("edit_school/", views.edit_school, name="edit-school"), + path("del_school", views.del_school, name="del-school"), + path("add_listright", views.add_listright, name="add-listright"), + path( + "edit_listright/", views.edit_listright, name="edit-listright", ), - url(r"^del_listright/$", views.del_listright, name="del-listright"), - url(r"^add_shell/$", views.add_shell, name="add-shell"), - url(r"^edit_shell/(?P[0-9]+)$", views.edit_shell, name="edit-shell"), - url(r"^del_shell/(?P[0-9]+)$", views.del_shell, name="del-shell"), - url(r"^profil/(?P[0-9]+)$", views.profil, name="profil"), - url(r"^index_ban/$", views.index_ban, name="index-ban"), - url(r"^index_white/$", views.index_white, name="index-white"), - url(r"^index_school/$", views.index_school, name="index-school"), - url(r"^index_shell/$", views.index_shell, name="index-shell"), - url(r"^index_listright/$", views.index_listright, name="index-listright"), - url(r"^index_serviceusers/$", views.index_serviceusers, name="index-serviceusers"), - url(r"^mon_profil/$", views.mon_profil, name="mon-profil"), - url(r"^process/(?P[a-z0-9]{32})/$", views.process, name="process"), - url(r"^reset_password/$", views.reset_password, name="reset-password"), - url(r"^mass_archive/$", views.mass_archive, name="mass-archive"), - url(r"^$", views.index, name="index"), - url(r"^index_clubs/$", views.index_clubs, name="index-clubs"), - url(r"^initial_register/$", views.initial_register, name="initial-register"), - url(r"^edit_theme/(?P[0-9]+)$", views.edit_theme, name="edit-theme"), + path("del_listright", views.del_listright, name="del-listright"), + path("add_shell", views.add_shell, name="add-shell"), + path("edit_shell/", views.edit_shell, name="edit-shell"), + path("del_shell/", views.del_shell, name="del-shell"), + path("profil/", views.profil, name="profil"), + path("index_ban", views.index_ban, name="index-ban"), + path("index_white", views.index_white, name="index-white"), + path("index_school", views.index_school, name="index-school"), + path("index_shell", views.index_shell, name="index-shell"), + path("index_listright", views.index_listright, name="index-listright"), + path("index_serviceusers", views.index_serviceusers, name="index-serviceusers"), + path("mon_profil", views.mon_profil, name="mon-profil"), + re_path(r"^process/(?P[a-z0-9]{32})/$", views.process, name="process"), + path("reset_password", views.reset_password, name="reset-password"), + path("mass_archive", views.mass_archive, name="mass-archive"), + path("", views.index, name="index"), + path("index_clubs", views.index_clubs, name="index-clubs"), + path("initial_register", views.initial_register, name="initial-register"), + path("edit_theme/", views.edit_theme, name="edit-theme"), ### Autocomplete Views - url(r'^user-autocomplete/$', views_autocomplete.UserAutocomplete.as_view(), name='user-autocomplete',), - url(r'^adherent-autocomplete/$', views_autocomplete.AdherentAutocomplete.as_view(), name='adherent-autocomplete',), - url(r'^club-autocomplete/$', views_autocomplete.ClubAutocomplete.as_view(), name='club-autocomplete',), - url(r'^school-autocomplete/$', views_autocomplete.SchoolAutocomplete.as_view(), name='school-autocomplete',), - url(r'^shell-autocomplete/$', views_autocomplete.ShellAutocomplete.as_view(), name='shell-autocomplete',), + path('user-autocomplete', views_autocomplete.UserAutocomplete.as_view(), name='user-autocomplete',), + path('adherent-autocomplete', views_autocomplete.AdherentAutocomplete.as_view(), name='adherent-autocomplete',), + path('club-autocomplete', views_autocomplete.ClubAutocomplete.as_view(), name='club-autocomplete',), + path('school-autocomplete', views_autocomplete.SchoolAutocomplete.as_view(), name='school-autocomplete',), + path('shell-autocomplete', views_autocomplete.ShellAutocomplete.as_view(), name='shell-autocomplete',), ]