8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 03:13:12 +00:00

feat: ⬆️ Support for django 2.2 (#308)

Support for django 2.2. Rename django.conf.urlresolvers. Change url to path. Add apps to app folder. Edit migrations for on_delete. Edit models for on_delete.

Drop compatibility for django 1.x
This commit is contained in:
Yoann Pétri 2021-02-09 13:01:42 +01:00 committed by klafyvel
parent 37ee9e30b8
commit 6736caf9f4
51 changed files with 909 additions and 540 deletions

11
api/apps.py Normal file
View file

@ -0,0 +1,11 @@
"""
Configuration of api app.
"""
from django.apps import AppConfig
class ApiConfig(AppConfig):
"""Configuration of api app."""
name = "api"

View file

@ -26,7 +26,7 @@
from collections import OrderedDict from collections import OrderedDict
from django.conf.urls import url 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 import views
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.reverse import reverse from rest_framework.reverse import reverse

View file

@ -28,13 +28,15 @@ can also be register. That way a complete API root page presenting all URLs
can be generated automatically. can be generated automatically.
""" """
from django.conf.urls import url, include from django.urls import path, include
from importlib import import_module from importlib import import_module
from . import views from . import views
from .routers import AllViewsRouter from .routers import AllViewsRouter
from django.conf import settings from django.conf import settings
app_name = "api"
router = AllViewsRouter() router = AllViewsRouter()
urls_viewset = [] urls_viewset = []
@ -65,4 +67,4 @@ for _url, view, name in urls_functional_view:
# TOKEN AUTHENTICATION # TOKEN AUTHENTICATION
router.register_view(r"token-auth", views.ObtainExpiringAuthToken) router.register_view(r"token-auth", views.ObtainExpiringAuthToken)
urlpatterns = [url(r"^", include(router.urls))] urlpatterns = [path("", include(router.urls))]

11
cotisations/apps.py Normal file
View file

@ -0,0 +1,11 @@
"""
Configuration of cotisations app.
"""
from django.apps import AppConfig
class CotisationsConfig(AppConfig):
"""Configuration of cotisations app."""
name = "cotisations"

View file

@ -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'},
),
]

View file

@ -40,12 +40,12 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name="cotisation", model_name="cotisation",
name="facture", name="facture",
field=models.OneToOneField(to="cotisations.Facture"), field=models.OneToOneField(to="cotisations.Facture", on_delete=models.CASCADE),
), ),
migrations.AlterField( migrations.AlterField(
model_name="vente", model_name="vente",
name="facture", name="facture",
field=models.ForeignKey(to="cotisations.Facture"), field=models.ForeignKey(to="cotisations.Facture", on_delete=models.CASCADE),
), ),
migrations.AlterField( migrations.AlterField(
model_name="vente", model_name="vente",

View file

@ -41,7 +41,7 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name="cotisation", model_name="cotisation",
name="vente", 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, preserve_default=False,
), ),
] ]

View file

@ -62,9 +62,6 @@ class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
class Meta: class Meta:
abstract = False abstract = False
permissions = (
("view_baseinvoice", _("Can view an base invoice object")),
)
# TODO : change prix to price # TODO : change prix to price
def prix(self): def prix(self):
@ -157,7 +154,6 @@ class Facture(BaseInvoice):
permissions = ( permissions = (
# TODO : change facture to invoice # TODO : change facture to invoice
("change_facture_control", _('Can edit the "controlled" state')), ("change_facture_control", _('Can edit the "controlled" state')),
("view_facture", _("Can view an invoice object")),
("change_all_facture", _("Can edit all the previous invoices")), ("change_all_facture", _("Can edit all the previous invoices")),
) )
verbose_name = _("invoice") verbose_name = _("invoice")
@ -377,8 +373,6 @@ def facture_post_delete(**kwargs):
class CustomInvoice(BaseInvoice): class CustomInvoice(BaseInvoice):
class Meta:
permissions = (("view_custominvoice", _("Can view a custom invoice object")),)
recipient = models.CharField(max_length=255, verbose_name=_("recipient")) recipient = models.CharField(max_length=255, verbose_name=_("recipient"))
payment = models.CharField(max_length=255, verbose_name=_("payment type")) payment = models.CharField(max_length=255, verbose_name=_("payment type"))
@ -388,8 +382,6 @@ class CustomInvoice(BaseInvoice):
class CostEstimate(CustomInvoice): class CostEstimate(CustomInvoice):
class Meta:
permissions = (("view_costestimate", _("Can view a cost estimate object")),)
validity = models.DurationField( validity = models.DurationField(
verbose_name=_("period of validity"), help_text="DD HH:MM:SS" verbose_name=_("period of validity"), help_text="DD HH:MM:SS"
@ -490,7 +482,6 @@ class Vente(RevMixin, AclMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_vente", _("Can view a purchase object")),
("change_all_vente", _("Can edit all the previous purchases")), ("change_all_vente", _("Can edit all the previous purchases")),
) )
verbose_name = _("purchase") verbose_name = _("purchase")
@ -750,7 +741,6 @@ class Article(RevMixin, AclMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_article", _("Can view an article object")),
("buy_every_article", _("Can buy every article")), ("buy_every_article", _("Can buy every article")),
) )
verbose_name = "article" verbose_name = "article"
@ -824,7 +814,6 @@ class Banque(RevMixin, AclMixin, models.Model):
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
class Meta: class Meta:
permissions = (("view_banque", _("Can view a bank object")),)
verbose_name = _("bank") verbose_name = _("bank")
verbose_name_plural = _("banks") verbose_name_plural = _("banks")
@ -856,7 +845,6 @@ class Paiement(RevMixin, AclMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_paiement", _("Can view a payment method object")),
("use_every_payment", _("Can use every payment method")), ("use_every_payment", _("Can use every payment method")),
) )
verbose_name = _("payment method") verbose_name = _("payment method")
@ -980,7 +968,6 @@ class Cotisation(RevMixin, AclMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_cotisation", _("Can view a subscription object")),
("change_all_cotisation", _("Can edit the previous subscriptions")), ("change_all_cotisation", _("Can edit the previous subscriptions")),
) )
verbose_name = _("subscription") verbose_name = _("subscription")

View file

@ -22,7 +22,7 @@ from django.conf.urls import include, url
from . import comnpay, cheque, note_kfet from . import comnpay, cheque, note_kfet
urlpatterns = [ urlpatterns = [
url(r"^comnpay/", include(comnpay.urls, namespace="comnpay")), url(r"^comnpay/", include((comnpay.urls, 'comnpay'), namespace="comnpay")),
url(r"^cheque/", include(cheque.urls, namespace="cheque")), url(r"^cheque/", include((cheque.urls, 'cheque'), namespace="cheque")),
url(r"^note_kfet/", include(note_kfet.urls, namespace="note_kfet")), url(r"^note_kfet/", include((note_kfet.urls, 'note_kfet'), namespace="note_kfet")),
] ]

View file

@ -25,85 +25,87 @@ The defined URLs for the Cotisations app
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf.urls import url from django.urls import path
from . import views, views_autocomplete from . import views, views_autocomplete
from . import payment_methods from . import payment_methods
app_name ="cotisations"
urlpatterns = [ urlpatterns = [
url(r"^new_facture/(?P<userid>[0-9]+)$", views.new_facture, name="new-facture"), path("new_facture/<int:userid>", views.new_facture, name="new-facture"),
url( path(
r"^edit_facture/(?P<factureid>[0-9]+)$", views.edit_facture, name="edit-facture" "edit_facture/<int:factureid>", views.edit_facture, name="edit-facture"
), ),
url(r"^del_facture/(?P<factureid>[0-9]+)$", views.del_facture, name="del-facture"), path("del_facture/<int:factureid>", views.del_facture, name="del-facture"),
url(r"^facture_pdf/(?P<factureid>[0-9]+)$", views.facture_pdf, name="facture-pdf"), path("facture_pdf/<int:factureid>", views.facture_pdf, name="facture-pdf"),
url(r"^voucher_pdf/(?P<factureid>[0-9]+)$", views.voucher_pdf, name="voucher-pdf"), path("voucher_pdf/<int:factureid>", views.voucher_pdf, name="voucher-pdf"),
url(r"^new_cost_estimate/$", views.new_cost_estimate, name="new-cost-estimate"), path("new_cost_estimate", views.new_cost_estimate, name="new-cost-estimate"),
url( path(
r"^index_cost_estimate/$", views.index_cost_estimate, name="index-cost-estimate" "index_cost_estimate", views.index_cost_estimate, name="index-cost-estimate"
), ),
url( path(
r"^cost_estimate_pdf/(?P<costestimateid>[0-9]+)$", "cost_estimate_pdf/<int:costestimateid>",
views.cost_estimate_pdf, views.cost_estimate_pdf,
name="cost-estimate-pdf", name="cost-estimate-pdf",
), ),
url( path(
r"^index_custom_invoice/$", "index_custom_invoice",
views.index_custom_invoice, views.index_custom_invoice,
name="index-custom-invoice", name="index-custom-invoice",
), ),
url( path(
r"^edit_cost_estimate/(?P<costestimateid>[0-9]+)$", "edit_cost_estimate/<int:costestimateid>",
views.edit_cost_estimate, views.edit_cost_estimate,
name="edit-cost-estimate", name="edit-cost-estimate",
), ),
url( path(
r"^cost_estimate_to_invoice/(?P<costestimateid>[0-9]+)$", "cost_estimate_to_invoice/<int:costestimateid>",
views.cost_estimate_to_invoice, views.cost_estimate_to_invoice,
name="cost-estimate-to-invoice", name="cost-estimate-to-invoice",
), ),
url( path(
r"^del_cost_estimate/(?P<costestimateid>[0-9]+)$", "del_cost_estimate/<int:costestimateid>",
views.del_cost_estimate, views.del_cost_estimate,
name="del-cost-estimate", name="del-cost-estimate",
), ),
url(r"^new_custom_invoice/$", views.new_custom_invoice, name="new-custom-invoice"), path("new_custom_invoice", views.new_custom_invoice, name="new-custom-invoice"),
url( path(
r"^edit_custom_invoice/(?P<custominvoiceid>[0-9]+)$", "edit_custom_invoice/<int:custominvoiceid>",
views.edit_custom_invoice, views.edit_custom_invoice,
name="edit-custom-invoice", name="edit-custom-invoice",
), ),
url( path(
r"^custom_invoice_pdf/(?P<custominvoiceid>[0-9]+)$", "custom_invoice_pdf/<int:custominvoiceid>",
views.custom_invoice_pdf, views.custom_invoice_pdf,
name="custom-invoice-pdf", name="custom-invoice-pdf",
), ),
url( path(
r"^del_custom_invoice/(?P<custominvoiceid>[0-9]+)$", "del_custom_invoice/<int:custominvoiceid>",
views.del_custom_invoice, views.del_custom_invoice,
name="del-custom-invoice", name="del-custom-invoice",
), ),
url(r"^credit_solde/(?P<userid>[0-9]+)$", views.credit_solde, name="credit-solde"), path("credit_solde/<int:userid>", views.credit_solde, name="credit-solde"),
url(r"^add_article/$", views.add_article, name="add-article"), path("add_article", views.add_article, name="add-article"),
url( path(
r"^edit_article/(?P<articleid>[0-9]+)$", views.edit_article, name="edit-article" "edit_article/<int:articleid>", views.edit_article, name="edit-article"
), ),
url(r"^del_article/$", views.del_article, name="del-article"), path("del_article", views.del_article, name="del-article"),
url(r"^add_paiement/$", views.add_paiement, name="add-paiement"), path("add_paiement", views.add_paiement, name="add-paiement"),
url( path(
r"^edit_paiement/(?P<paiementid>[0-9]+)$", "edit_paiement/<int:paiementid>",
views.edit_paiement, views.edit_paiement,
name="edit-paiement", name="edit-paiement",
), ),
url(r"^del_paiement/$", views.del_paiement, name="del-paiement"), path("del_paiement", views.del_paiement, name="del-paiement"),
url(r"^add_banque/$", views.add_banque, name="add-banque"), path("add_banque", views.add_banque, name="add-banque"),
url(r"^edit_banque/(?P<banqueid>[0-9]+)$", views.edit_banque, name="edit-banque"), path("edit_banque/<int:banqueid>", views.edit_banque, name="edit-banque"),
url(r"^del_banque/$", views.del_banque, name="del-banque"), path("del_banque", views.del_banque, name="del-banque"),
url(r"^index_article/$", views.index_article, name="index-article"), path("index_article", views.index_article, name="index-article"),
url(r"^index_banque/$", views.index_banque, name="index-banque"), path("index_banque", views.index_banque, name="index-banque"),
url(r"^index_paiement/$", views.index_paiement, name="index-paiement"), path("index_paiement", views.index_paiement, name="index-paiement"),
url(r"^control/$", views.control, name="control"), path("control", views.control, name="control"),
url(r"^$", views.index, name="index"), path("", views.index, name="index"),
### Autocomplete Views ### 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 ] + payment_methods.urls.urlpatterns

View file

@ -1,4 +1,6 @@
from django.conf.urls import url from django.urls import path
from .import views from .import views
app_name = "ldap_sync"
urlpatterns = [] urlpatterns = []

11
logs/apps.py Normal file
View file

@ -0,0 +1,11 @@
"""
Configuration of logs app.
"""
from django.apps import AppConfig
class LogsConfig(AppConfig):
"""Configuration of logs app."""
name = "logs"

View file

@ -24,26 +24,28 @@ The defined URLs for the logs app. Included in re2o.urls.
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf.urls import url from django.urls import path
from . import views from . import views
app_name = "logs"
urlpatterns = [ urlpatterns = [
url(r"^$", views.index, name="index"), path("", views.index, name="index"),
url(r"^stats_logs$", views.stats_logs, name="stats-logs"), path("stats_logs", views.stats_logs, name="stats-logs"),
url( path(
r"^revert_action/(?P<revision_id>[0-9]+)$", "revert_action/<int:revision_id>",
views.revert_action, views.revert_action,
name="revert-action", name="revert-action",
), ),
url( path(
r"(?P<application>\w+)/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$", "<str:application>/<str:object_name>/<int:object_id>",
views.history, views.history,
name="history", name="history",
), ),
url(r"^stats_general/$", views.stats_general, name="stats-general"), path("stats_general", views.stats_general, name="stats-general"),
url(r"^stats_models/$", views.stats_models, name="stats-models"), path("stats_models", views.stats_models, name="stats-models"),
url(r"^stats_users/$", views.stats_users, name="stats-users"), path("stats_users", views.stats_users, name="stats-users"),
url(r"^stats_actions/$", views.stats_actions, name="stats-actions"), path("stats_actions", views.stats_actions, name="stats-actions"),
url(r"^stats_search_machine/$", views.stats_search_machine_history, name="stats-search-machine"), path("stats_search_machine", views.stats_search_machine_history, name="stats-search-machine"),
] ]

11
machines/apps.py Normal file
View file

@ -0,0 +1,11 @@
"""
Configuration of machines app.
"""
from django.apps import AppConfig
class MachinesConfig(AppConfig):
"""Configuration of machines app."""
name = "machines"

View file

@ -1098,7 +1098,7 @@ class Migration(migrations.Migration):
( (
"cname", "cname",
models.ForeignKey( models.ForeignKey(
"self", null=True, blank=True, related_name="related_domain" "self", null=True, blank=True, related_name="related_domain", on_delete=models.CASCADE
), ),
), ),
( (

View file

@ -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'),
),
]

View file

@ -34,6 +34,6 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name="interface", model_name="interface",
name="machine", name="machine",
field=models.ForeignKey(to="machines.Machine"), field=models.ForeignKey(to="machines.Machine", on_delete=models.CASCADE),
) )
] ]

View file

@ -51,7 +51,7 @@ class Migration(migrations.Migration):
unique=True, unique=True,
), ),
), ),
("interface_parent", models.ForeignKey(to="machines.Interface")), ("interface_parent", models.ForeignKey(to="machines.Interface", on_delete=models.CASCADE)),
], ],
) )
] ]

View file

@ -35,7 +35,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name="domain", model_name="domain",
name="interface_parent", 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( migrations.AlterUniqueTogether(
name="domain", unique_together=set([("name", "extension")]) name="domain", unique_together=set([("name", "extension")])

View file

@ -39,6 +39,7 @@ class Migration(migrations.Migration):
null=True, null=True,
to="machines.Domain", to="machines.Domain",
blank=True, blank=True,
on_delete=models.CASCADE
), ),
) )
] ]

View file

@ -39,6 +39,7 @@ class Migration(migrations.Migration):
to="machines.Domain", to="machines.Domain",
related_name="related_domain", related_name="related_domain",
blank=True, blank=True,
on_delete=models.CASCADE,
), ),
) )
] ]

View file

@ -34,6 +34,6 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name="domain", model_name="domain",
name="interface_parent", 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),
) )
] ]

View file

@ -80,7 +80,6 @@ class Machine(RevMixin, FieldPermissionModelMixin, AclMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_machine", _("Can view a machine object")),
("change_machine_user", _("Can change the user of a machine")), ("change_machine_user", _("Can change the user of a machine")),
) )
verbose_name = _("machine") verbose_name = _("machine")
@ -344,7 +343,6 @@ class MachineType(RevMixin, AclMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_machinetype", _("Can view a machine type object")),
("use_all_machinetype", _("Can use all machine types")), ("use_all_machinetype", _("Can use all machine types")),
) )
verbose_name = _("machine type") verbose_name = _("machine type")
@ -457,11 +455,10 @@ class IpType(RevMixin, AclMixin, models.Model):
default=False, help_text=_("Enable reverse DNS for IPv6.") default=False, help_text=_("Enable reverse DNS for IPv6.")
) )
vlan = models.ForeignKey("Vlan", on_delete=models.PROTECT, blank=True, null=True) 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: class Meta:
permissions = ( permissions = (
("view_iptype", _("Can view an IP type object")),
("use_all_iptype", _("Can use all IP types")), ("use_all_iptype", _("Can use all IP types")),
) )
verbose_name = _("IP type") verbose_name = _("IP type")
@ -729,7 +726,6 @@ class Vlan(RevMixin, AclMixin, models.Model):
mld = models.BooleanField(default=False, help_text=_("v6 multicast management.")) mld = models.BooleanField(default=False, help_text=_("v6 multicast management."))
class Meta: class Meta:
permissions = (("view_vlan", _("Can view a VLAN object")),)
verbose_name = _("VLAN") verbose_name = _("VLAN")
verbose_name_plural = _("VLANs") verbose_name_plural = _("VLANs")
@ -765,7 +761,6 @@ class Nas(RevMixin, AclMixin, models.Model):
autocapture_mac = models.BooleanField(default=False) autocapture_mac = models.BooleanField(default=False)
class Meta: class Meta:
permissions = (("view_nas", _("Can view a NAS device object")),)
verbose_name = _("NAS device") verbose_name = _("NAS device")
verbose_name_plural = _("NAS devices") verbose_name_plural = _("NAS devices")
@ -819,7 +814,6 @@ class SOA(RevMixin, AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_soa", _("Can view an SOA record object")),)
verbose_name = _("SOA record") verbose_name = _("SOA record")
verbose_name_plural = _("SOA records") verbose_name_plural = _("SOA records")
@ -904,7 +898,6 @@ class Extension(RevMixin, AclMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_extension", _("Can view an extension object")),
("use_all_extension", _("Can use all extensions")), ("use_all_extension", _("Can use all extensions")),
) )
verbose_name = _("DNS extension") verbose_name = _("DNS extension")
@ -1037,7 +1030,6 @@ class Mx(RevMixin, AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_mx", _("Can view an MX record object")),)
verbose_name = _("MX record") verbose_name = _("MX record")
verbose_name_plural = _("MX records") verbose_name_plural = _("MX records")
@ -1069,7 +1061,6 @@ class Ns(RevMixin, AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_ns", _("Can view an NS record object")),)
verbose_name = _("NS record") verbose_name = _("NS record")
verbose_name_plural = _("NS records") verbose_name_plural = _("NS records")
@ -1101,7 +1092,6 @@ class Txt(RevMixin, AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_txt", _("Can view a TXT record object")),)
verbose_name = _("TXT record") verbose_name = _("TXT record")
verbose_name_plural = _("TXT records") verbose_name_plural = _("TXT records")
@ -1131,7 +1121,6 @@ class DName(RevMixin, AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_dname", _("Can view a DNAME record object")),)
verbose_name = _("DNAME record") verbose_name = _("DNAME record")
verbose_name_plural = _("DNAME records") verbose_name_plural = _("DNAME records")
@ -1195,7 +1184,6 @@ class Srv(RevMixin, AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_srv", _("Can view an SRV record object")),)
verbose_name = _("SRV record") verbose_name = _("SRV record")
verbose_name_plural = _("SRV records") verbose_name_plural = _("SRV records")
@ -1285,7 +1273,6 @@ class SshFp(RevMixin, AclMixin, models.Model):
} }
class Meta: class Meta:
permissions = (("view_sshfp", _("Can view an SSHFP record object")),)
verbose_name = _("SSHFP record") verbose_name = _("SSHFP record")
verbose_name_plural = _("SSHFP records") verbose_name_plural = _("SSHFP records")
@ -1350,7 +1337,6 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_interface", _("Can view an interface object")),
("change_interface_machine", _("Can change the owner of an interface")), ("change_interface_machine", _("Can change the owner of an interface")),
) )
verbose_name = _("interface") verbose_name = _("interface")
@ -1741,7 +1727,6 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
class Meta: class Meta:
permissions = ( permissions = (
("view_ipv6list", _("Can view an IPv6 addresses list object")),
( (
"change_ipv6list_slaac_ip", "change_ipv6list_slaac_ip",
_("Can change the SLAAC value of an IPv6 addresses list"), _("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) extension = models.ForeignKey("Extension", on_delete=models.PROTECT)
cname = models.ForeignKey( 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( ttl = models.PositiveIntegerField(
verbose_name=_("Time To Live (TTL)"), verbose_name=_("Time To Live (TTL)"),
@ -1956,7 +1941,6 @@ class Domain(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
class Meta: class Meta:
unique_together = (("name", "extension"),) unique_together = (("name", "extension"),)
permissions = ( permissions = (
("view_domain", _("Can view a domain object")),
("change_ttl", _("Can change the TTL of a domain object")), ("change_ttl", _("Can change the TTL of a domain object")),
) )
verbose_name = _("domain") verbose_name = _("domain")
@ -2184,7 +2168,6 @@ class IpList(RevMixin, AclMixin, models.Model):
ip_type = models.ForeignKey("IpType", on_delete=models.CASCADE) ip_type = models.ForeignKey("IpType", on_delete=models.CASCADE)
class Meta: class Meta:
permissions = (("view_iplist", _("Can view an IPv4 addresses list object")),)
verbose_name = _("IPv4 addresses list") verbose_name = _("IPv4 addresses list")
verbose_name_plural = _("IPv4 addresses lists") 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) specific_role = models.CharField(choices=ROLE, null=True, blank=True, max_length=32)
class Meta: class Meta:
permissions = (("view_role", _("Can view a role object")),)
verbose_name = _("server role") verbose_name = _("server role")
verbose_name_plural = _("server roles") verbose_name_plural = _("server roles")
@ -2325,7 +2307,6 @@ class Service(RevMixin, AclMixin, models.Model):
servers = models.ManyToManyField("Interface", through="Service_link") servers = models.ManyToManyField("Interface", through="Service_link")
class Meta: class Meta:
permissions = (("view_service", _("Can view a service object")),)
verbose_name = _("service to generate (DHCP, DNS, ...)") verbose_name = _("service to generate (DHCP, DNS, ...)")
verbose_name_plural = _("services 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) asked_regen = models.BooleanField(default=False)
class Meta: class Meta:
permissions = (
("view_service_link", _("Can view a service server link object")),
)
verbose_name = _("link between service and server") verbose_name = _("link between service and server")
verbose_name_plural = _("links between service and server") verbose_name_plural = _("links between service and server")
@ -2438,9 +2416,6 @@ class OuverturePortList(RevMixin, AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (
("view_ouvertureportlist", _("Can view a ports opening list" " object")),
)
verbose_name = _("ports opening list") verbose_name = _("ports opening list")
verbose_name_plural = _("ports opening lists") verbose_name_plural = _("ports opening lists")

View file

@ -26,142 +26,144 @@ The defined URLs for the Machines app
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf.urls import url from django.urls import path
from . import views from . import views
from . import views_autocomplete from . import views_autocomplete
app_name = "machines"
urlpatterns = [ urlpatterns = [
url(r"^new_machine/(?P<userid>[0-9]+)$", views.new_machine, name="new-machine"), path("new_machine/<int:userid>", views.new_machine, name="new-machine"),
url( path(
r"^edit_interface/(?P<interfaceid>[0-9]+)$", "edit_interface/<int:interfaceid>",
views.edit_interface, views.edit_interface,
name="edit-interface", name="edit-interface",
), ),
url(r"^del_machine/(?P<machineid>[0-9]+)$", views.del_machine, name="del-machine"), path("del_machine/<int:machineid>", views.del_machine, name="del-machine"),
url( path(
r"^new_interface/(?P<machineid>[0-9]+)$", "new_interface/<int:machineid>",
views.new_interface, views.new_interface,
name="new-interface", name="new-interface",
), ),
url( path(
r"^del_interface/(?P<interfaceid>[0-9]+)$", "del_interface/<int:interfaceid>",
views.del_interface, views.del_interface,
name="del-interface", name="del-interface",
), ),
url(r"^add_machinetype/$", views.add_machinetype, name="add-machinetype"), path("add_machinetype", views.add_machinetype, name="add-machinetype"),
url( path(
r"^edit_machinetype/(?P<machinetypeid>[0-9]+)$", "edit_machinetype/<int:machinetypeid>",
views.edit_machinetype, views.edit_machinetype,
name="edit-machinetype", name="edit-machinetype",
), ),
url(r"^del_machinetype/$", views.del_machinetype, name="del-machinetype"), path("del_machinetype", views.del_machinetype, name="del-machinetype"),
url(r"^index_machinetype/$", views.index_machinetype, name="index-machinetype"), path("index_machinetype", views.index_machinetype, name="index-machinetype"),
url(r"^add_iptype/$", views.add_iptype, name="add-iptype"), path("add_iptype", views.add_iptype, name="add-iptype"),
url(r"^edit_iptype/(?P<iptypeid>[0-9]+)$", views.edit_iptype, name="edit-iptype"), path("edit_iptype/<int:iptypeid>", views.edit_iptype, name="edit-iptype"),
url(r"^del_iptype/$", views.del_iptype, name="del-iptype"), path("del_iptype", views.del_iptype, name="del-iptype"),
url(r"^index_iptype/$", views.index_iptype, name="index-iptype"), path("index_iptype", views.index_iptype, name="index-iptype"),
url(r"^add_extension/$", views.add_extension, name="add-extension"), path("add_extension", views.add_extension, name="add-extension"),
url( path(
r"^edit_extension/(?P<extensionid>[0-9]+)$", "edit_extension/<int:extensionid>",
views.edit_extension, views.edit_extension,
name="edit-extension", name="edit-extension",
), ),
url(r"^del_extension/$", views.del_extension, name="del-extension"), path("del_extension", views.del_extension, name="del-extension"),
url(r"^add_soa/$", views.add_soa, name="add-soa"), path("add_soa", views.add_soa, name="add-soa"),
url(r"^edit_soa/(?P<soaid>[0-9]+)$", views.edit_soa, name="edit-soa"), path("edit_soa/<int:soaid>", views.edit_soa, name="edit-soa"),
url(r"^del_soa/$", views.del_soa, name="del-soa"), path("del_soa", views.del_soa, name="del-soa"),
url(r"^add_mx/$", views.add_mx, name="add-mx"), path("add_mx", views.add_mx, name="add-mx"),
url(r"^edit_mx/(?P<mxid>[0-9]+)$", views.edit_mx, name="edit-mx"), path("edit_mx/<int:mxid>", views.edit_mx, name="edit-mx"),
url(r"^del_mx/$", views.del_mx, name="del-mx"), path("del_mx", views.del_mx, name="del-mx"),
url(r"^add_txt/$", views.add_txt, name="add-txt"), path("add_txt", views.add_txt, name="add-txt"),
url(r"^edit_txt/(?P<txtid>[0-9]+)$", views.edit_txt, name="edit-txt"), path("edit_txt/<int:txtid>", views.edit_txt, name="edit-txt"),
url(r"^del_txt/$", views.del_txt, name="del-txt"), path("del_txt", views.del_txt, name="del-txt"),
url(r"^add_dname/$", views.add_dname, name="add-dname"), path("add_dname", views.add_dname, name="add-dname"),
url(r"^edit_dname/(?P<dnameid>[0-9]+)$", views.edit_dname, name="edit-dname"), path("edit_dname/<int:dnameid>", views.edit_dname, name="edit-dname"),
url(r"^del_dname/$", views.del_dname, name="del-dname"), path("del_dname", views.del_dname, name="del-dname"),
url(r"^add_ns/$", views.add_ns, name="add-ns"), path("add_ns", views.add_ns, name="add-ns"),
url(r"^edit_ns/(?P<nsid>[0-9]+)$", views.edit_ns, name="edit-ns"), path("edit_ns/<int:nsid>", views.edit_ns, name="edit-ns"),
url(r"^del_ns/$", views.del_ns, name="del-ns"), path("del_ns", views.del_ns, name="del-ns"),
url(r"^add_srv/$", views.add_srv, name="add-srv"), path("add_srv", views.add_srv, name="add-srv"),
url(r"^edit_srv/(?P<srvid>[0-9]+)$", views.edit_srv, name="edit-srv"), path("edit_srv/<int:srvid>", views.edit_srv, name="edit-srv"),
url(r"^del_srv/$", views.del_srv, name="del-srv"), path("del_srv", views.del_srv, name="del-srv"),
url(r"^new_sshfp/(?P<machineid>[0-9]+)$", views.new_sshfp, name="new-sshfp"), path("new_sshfp/<int:machineid>", views.new_sshfp, name="new-sshfp"),
url(r"^edit_sshfp/(?P<sshfpid>[0-9]+)$", views.edit_sshfp, name="edit-sshfp"), path("edit_sshfp/<int:sshfpid>", views.edit_sshfp, name="edit-sshfp"),
url(r"^del_sshfp/(?P<sshfpid>[0-9]+)$", views.del_sshfp, name="del-sshfp"), path("del_sshfp/<int:sshfpid>", views.del_sshfp, name="del-sshfp"),
url(r"^index_sshfp/(?P<machineid>[0-9]+)$", views.index_sshfp, name="index-sshfp"), path("index_sshfp/<int:machineid>", views.index_sshfp, name="index-sshfp"),
url(r"^index_extension/$", views.index_extension, name="index-extension"), path("index_extension", views.index_extension, name="index-extension"),
url(r"^add_alias/(?P<interfaceid>[0-9]+)$", views.add_alias, name="add-alias"), path("add_alias/<int:interfaceid>", views.add_alias, name="add-alias"),
url(r"^edit_alias/(?P<domainid>[0-9]+)$", views.edit_alias, name="edit-alias"), path("edit_alias/<int:domainid>", views.edit_alias, name="edit-alias"),
url(r"^del_alias/(?P<interfaceid>[0-9]+)$", views.del_alias, name="del-alias"), path("del_alias/<int:interfaceid>", views.del_alias, name="del-alias"),
url( path(
r"^index_alias/(?P<interfaceid>[0-9]+)$", views.index_alias, name="index-alias" "index_alias/<int:interfaceid>", views.index_alias, name="index-alias"
), ),
url( path(
r"^new_ipv6list/(?P<interfaceid>[0-9]+)$", "new_ipv6list/<int:interfaceid>",
views.new_ipv6list, views.new_ipv6list,
name="new-ipv6list", name="new-ipv6list",
), ),
url( path(
r"^edit_ipv6list/(?P<ipv6listid>[0-9]+)$", "edit_ipv6list/<int:ipv6listid>",
views.edit_ipv6list, views.edit_ipv6list,
name="edit-ipv6list", name="edit-ipv6list",
), ),
url( path(
r"^del_ipv6list/(?P<ipv6listid>[0-9]+)$", "del_ipv6list/<int:ipv6listid>",
views.del_ipv6list, views.del_ipv6list,
name="del-ipv6list", name="del-ipv6list",
), ),
url(r"^index_ipv6/(?P<interfaceid>[0-9]+)$", views.index_ipv6, name="index-ipv6"), path("index_ipv6/<int:interfaceid>", views.index_ipv6, name="index-ipv6"),
url(r"^add_service/$", views.add_service, name="add-service"), path("add_service", views.add_service, name="add-service"),
url( path(
r"^edit_service/(?P<serviceid>[0-9]+)$", views.edit_service, name="edit-service" "edit_service/<int:serviceid>", views.edit_service, name="edit-service"
), ),
url(r"^del_service/$", views.del_service, name="del-service"), path("del_service", views.del_service, name="del-service"),
url( path(
r"^regen_service/(?P<serviceid>[0-9]+)$", "regen_service/<int:serviceid>",
views.regen_service, views.regen_service,
name="regen-service", name="regen-service",
), ),
url(r"^index_service/$", views.index_service, name="index-service"), path("index_service", views.index_service, name="index-service"),
url(r"^add_role/$", views.add_role, name="add-role"), path("add_role", views.add_role, name="add-role"),
url(r"^edit_role/(?P<roleid>[0-9]+)$", views.edit_role, name="edit-role"), path("edit_role/<int:roleid>", views.edit_role, name="edit-role"),
url(r"^del_role/$", views.del_role, name="del-role"), path("del_role", views.del_role, name="del-role"),
url(r"^index_role/$", views.index_role, name="index-role"), path("index_role", views.index_role, name="index-role"),
url(r"^add_vlan/$", views.add_vlan, name="add-vlan"), path("add_vlan", views.add_vlan, name="add-vlan"),
url(r"^edit_vlan/(?P<vlanid>[0-9]+)$", views.edit_vlan, name="edit-vlan"), path("edit_vlan/<int:vlanid>", views.edit_vlan, name="edit-vlan"),
url(r"^del_vlan/$", views.del_vlan, name="del-vlan"), path("del_vlan", views.del_vlan, name="del-vlan"),
url(r"^index_vlan/$", views.index_vlan, name="index-vlan"), path("index_vlan", views.index_vlan, name="index-vlan"),
url(r"^add_nas/$", views.add_nas, name="add-nas"), path("add_nas", views.add_nas, name="add-nas"),
url(r"^edit_nas/(?P<nasid>[0-9]+)$", views.edit_nas, name="edit-nas"), path("edit_nas/<int:nasid>", views.edit_nas, name="edit-nas"),
url(r"^del_nas/$", views.del_nas, name="del-nas"), path("del_nas", views.del_nas, name="del-nas"),
url(r"^index_nas/$", views.index_nas, name="index-nas"), path("index_nas", views.index_nas, name="index-nas"),
url(r"^$", views.index, name="index"), path("", views.index, name="index"),
url(r"index_portlist/$", views.index_portlist, name="index-portlist"), path("index_portlist", views.index_portlist, name="index-portlist"),
url( path(
r"^edit_portlist/(?P<ouvertureportlistid>[0-9]+)$", "edit_portlist/<int:ouvertureportlistid>",
views.edit_portlist, views.edit_portlist,
name="edit-portlist", name="edit-portlist",
), ),
url( path(
r"^del_portlist/(?P<ouvertureportlistid>[0-9]+)$", "del_portlist/<int:ouvertureportlistid>",
views.del_portlist, views.del_portlist,
name="del-portlist", name="del-portlist",
), ),
url(r"^add_portlist/$", views.add_portlist, name="add-portlist"), path("add_portlist", views.add_portlist, name="add-portlist"),
url( path(
r"^port_config/(?P<interfaceid>[0-9]+)$", "port_config/<int:interfaceid>",
views.configure_ports, views.configure_ports,
name="port-config", name="port-config",
), ),
### Autocomplete Views ### Autocomplete Views
url(r'^vlan-autocomplete/$', views_autocomplete.VlanAutocomplete.as_view(), name='vlan-autocomplete',), path('vlan-autocomplete', views_autocomplete.VlanAutocomplete.as_view(), name='vlan-autocomplete',),
url(r'^interface-autocomplete/$', views_autocomplete.InterfaceAutocomplete.as_view(), name='interface-autocomplete',), path('interface-autocomplete', views_autocomplete.InterfaceAutocomplete.as_view(), name='interface-autocomplete',),
url(r'^machine-autocomplete/$', views_autocomplete.MachineAutocomplete.as_view(), name='machine-autocomplete',), path('machine-autocomplete', views_autocomplete.MachineAutocomplete.as_view(), name='machine-autocomplete',),
url(r'^machinetype-autocomplete/$', views_autocomplete.MachineTypeAutocomplete.as_view(), name='machinetype-autocomplete',), path('machinetype-autocomplete', views_autocomplete.MachineTypeAutocomplete.as_view(), name='machinetype-autocomplete',),
url(r'^iptype-autocomplete/$', views_autocomplete.IpTypeAutocomplete.as_view(), name='iptype-autocomplete',), path('iptype-autocomplete', views_autocomplete.IpTypeAutocomplete.as_view(), name='iptype-autocomplete',),
url(r'^extension-autocomplete/$', views_autocomplete.ExtensionAutocomplete.as_view(), name='extension-autocomplete',), path('extension-autocomplete', views_autocomplete.ExtensionAutocomplete.as_view(), name='extension-autocomplete',),
url(r'^domain-autocomplete/$', views_autocomplete.DomainAutocomplete.as_view(), name='domain-autocomplete',), path('domain-autocomplete', views_autocomplete.DomainAutocomplete.as_view(), name='domain-autocomplete',),
url(r'^ouvertureportlist-autocomplete/$', views_autocomplete.OuverturePortListAutocomplete.as_view(), name='ouvertureportlist-autocomplete',), path('ouvertureportlist-autocomplete', views_autocomplete.OuverturePortListAutocomplete.as_view(), name='ouvertureportlist-autocomplete',),
url(r'^iplist-autocomplete/$', views_autocomplete.IpListAutocomplete.as_view(), name='iplist-autocomplete',), path('iplist-autocomplete', views_autocomplete.IpListAutocomplete.as_view(), name='iplist-autocomplete',),
] ]

View file

@ -25,35 +25,37 @@ For further details on each of those models, see the documentation details for
each. each.
""" """
from django.conf.urls import url from django.urls import path, re_path
from . import views from . import views
from .preferences.views import edit_options from .preferences.views import edit_options
app_name = "multi_op"
urlpatterns = [ urlpatterns = [
url(r"^$", views.aff_state_global, name="aff-state-global"), path("", views.aff_state_global, name="aff-state-global"),
url( path(
r"^(?P<dormitoryid>[0-9]+)$", "<int:dormitoryid>",
views.aff_state_dormitory, views.aff_state_dormitory,
name="aff-state-dormitory", name="aff-state-dormitory",
), ),
url( re_path(
r"^edit_options/(?P<section>MultiopOption)$", r"^edit_options/(?P<section>MultiopOption)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url( path(
r"^pending-connection$", "pending-connection",
views.aff_pending_connection, views.aff_pending_connection,
name="aff-pending-connection", name="aff-pending-connection",
), ),
url( path(
r"^pending-disconnection$", "pending-disconnection",
views.aff_pending_disconnection, views.aff_pending_disconnection,
name="aff-pending-disconnection", name="aff-pending-disconnection",
), ),
url( path(
r"^disconnect-room/(?P<roomid>[0-9]+)$", "disconnect-room/<int:roomid>",
views.disconnect_room, views.disconnect_room,
name="disconnect-room", name="disconnect-room",
), ),

11
preferences/apps.py Normal file
View file

@ -0,0 +1,11 @@
"""
Configuration of preferences app.
"""
from django.apps import AppConfig
class PreferencesConfig(AppConfig):
"""Configuration of preferences app."""
name = "preferences"

View file

@ -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'},
),
]

View file

@ -185,7 +185,6 @@ class OptionalUser(AclMixin, PreferencesModel):
) )
class Meta: class Meta:
permissions = (("view_optionaluser", _("Can view the user preferences")),)
verbose_name = _("user preferences") verbose_name = _("user preferences")
def clean(self): def clean(self):
@ -241,7 +240,6 @@ class OptionalMachine(AclMixin, PreferencesModel):
return not self.get_cached_value("ipv6_mode") == "DISABLED" return not self.get_cached_value("ipv6_mode") == "DISABLED"
class Meta: class Meta:
permissions = (("view_optionalmachine", _("Can view the machine preferences")),)
verbose_name = _("machine preferences") verbose_name = _("machine preferences")
@ -421,9 +419,6 @@ class OptionalTopologie(AclMixin, PreferencesModel):
) )
class Meta: class Meta:
permissions = (
("view_optionaltopologie", _("Can view the topology preferences")),
)
verbose_name = _("topology preferences") verbose_name = _("topology preferences")
@ -453,7 +448,6 @@ class RadiusKey(AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_radiuskey", _("Can view a RADIUS key object")),)
verbose_name = _("RADIUS key") verbose_name = _("RADIUS key")
verbose_name_plural = _("RADIUS keys") verbose_name_plural = _("RADIUS keys")
@ -483,12 +477,6 @@ class SwitchManagementCred(AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (
(
"view_switchmanagementcred",
_("Can view a switch management credentials object"),
),
)
verbose_name = _("switch management credentials") verbose_name = _("switch management credentials")
def __str__(self): def __str__(self):
@ -518,7 +506,6 @@ class Reminder(AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_reminder", _("Can view a reminder object")),)
verbose_name = _("reminder") verbose_name = _("reminder")
verbose_name_plural = _("reminders") verbose_name_plural = _("reminders")
@ -582,7 +569,6 @@ class GeneralOption(AclMixin, PreferencesModel):
GTU = models.FileField(upload_to="", default="", null=True, blank=True) GTU = models.FileField(upload_to="", default="", null=True, blank=True)
class Meta: class Meta:
permissions = (("view_generaloption", _("Can view the general preferences")),)
verbose_name = _("general preferences") verbose_name = _("general preferences")
@ -609,7 +595,6 @@ class Service(AclMixin, models.Model):
image = models.ImageField(upload_to="logo", blank=True) image = models.ImageField(upload_to="logo", blank=True)
class Meta: class Meta:
permissions = (("view_service", _("Can view the service preferences")),)
verbose_name = _("service") verbose_name = _("service")
verbose_name_plural = _("services") verbose_name_plural = _("services")
@ -641,9 +626,6 @@ class MailContact(AclMixin, models.Model):
return self.address.split("@")[0] return self.address.split("@")[0]
class Meta: class Meta:
permissions = (
("view_mailcontact", _("Can view a contact email address object")),
)
verbose_name = _("contact email address") verbose_name = _("contact email address")
verbose_name_plural = _("contact email addresses") verbose_name_plural = _("contact email addresses")
@ -664,7 +646,6 @@ class Mandate(RevMixin, AclMixin, models.Model):
class Meta: class Meta:
verbose_name = _("mandate") verbose_name = _("mandate")
verbose_name_plural = _("mandates") verbose_name_plural = _("mandates")
permissions = (("view_mandate", _("Can view a mandate object")),)
president = models.ForeignKey( president = models.ForeignKey(
"users.User", "users.User",
@ -740,7 +721,6 @@ class AssoOption(AclMixin, PreferencesModel):
description = models.TextField(null=True, blank=True) description = models.TextField(null=True, blank=True)
class Meta: class Meta:
permissions = (("view_assooption", _("Can view the organisation preferences")),)
verbose_name = _("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) twitter_account_name = models.CharField(max_length=32, null=True, blank=True)
class Meta: class Meta:
permissions = (("view_homeoption", _("Can view the homepage preferences")),)
verbose_name = _("homepage preferences") verbose_name = _("homepage preferences")
@ -793,9 +772,6 @@ class MailMessageOption(AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (
("view_mailmessageoption", _("Can view the email message preferences")),
)
verbose_name = _("email message preferences") verbose_name = _("email message preferences")

View file

@ -25,139 +25,140 @@ Urls de l'application preferences, pointant vers les fonctions de views
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf.urls import url from django.urls import path, re_path
from . import views from . import views
from .views import edit_options from .views import edit_options
app_name = "preferences"
urlpatterns = [ urlpatterns = [
url( re_path(
r"^edit_options/(?P<section>OptionalUser)$", r"^edit_options/(?P<section>OptionalUser)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url( re_path(
r"^edit_options/(?P<section>OptionalMachine)$", r"^edit_options/(?P<section>OptionalMachine)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url( re_path(
r"^edit_options/(?P<section>OptionalTopologie)$", r"^edit_options/(?P<section>OptionalTopologie)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url( re_path(
r"^edit_options/(?P<section>GeneralOption)$", r"^edit_options/(?P<section>GeneralOption)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url( re_path(
r"^edit_options/(?P<section>AssoOption)$", r"^edit_options/(?P<section>AssoOption)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url( re_path(
r"^edit_options/(?P<section>HomeOption)$", r"^edit_options/(?P<section>HomeOption)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url( re_path(
r"^edit_options/(?P<section>MailMessageOption)$", r"^edit_options/(?P<section>MailMessageOption)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url( re_path(
r"^edit_options/(?P<section>RadiusOption)$", r"^edit_options/(?P<section>RadiusOption)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url( re_path(
r"^edit_options/(?P<section>CotisationsOption)$", r"^edit_options/(?P<section>CotisationsOption)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url(r"^add_service/$", views.add_service, name="add-service"), path("add_service", views.add_service, name="add-service"),
url( path(
r"^edit_service/(?P<serviceid>[0-9]+)$", views.edit_service, name="edit-service" "edit_service/<int:serviceid>", views.edit_service, name="edit-service"
), ),
url(r"^del_service/(?P<serviceid>[0-9]+)$", views.del_service, name="del-service"), path("del_service/<int:serviceid>", views.del_service, name="del-service"),
url(r"^add_mailcontact/$", views.add_mailcontact, name="add-mailcontact"), path("add_mailcontact", views.add_mailcontact, name="add-mailcontact"),
url( path(
r"^edit_mailcontact/(?P<mailcontactid>[0-9]+)$", "edit_mailcontact/<int:mailcontactid>",
views.edit_mailcontact, views.edit_mailcontact,
name="edit-mailcontact", name="edit-mailcontact",
), ),
url(r"^del_mailcontact/$", views.del_mailcontact, name="del-mailcontact"), path("del_mailcontact", views.del_mailcontact, name="del-mailcontact"),
url(r"^add_reminder/$", views.add_reminder, name="add-reminder"), path("add_reminder", views.add_reminder, name="add-reminder"),
url( path(
r"^edit_reminder/(?P<reminderid>[0-9]+)$", "edit_reminder/<int:reminderid>",
views.edit_reminder, views.edit_reminder,
name="edit-reminder", name="edit-reminder",
), ),
url( path(
r"^del_reminder/(?P<reminderid>[0-9]+)$", "del_reminder/<int:reminderid>",
views.del_reminder, views.del_reminder,
name="del-reminder", name="del-reminder",
), ),
url(r"^add_radiuskey/$", views.add_radiuskey, name="add-radiuskey"), path("add_radiuskey", views.add_radiuskey, name="add-radiuskey"),
url( path(
r"^edit_radiuskey/(?P<radiuskeyid>[0-9]+)$", "edit_radiuskey/<int:radiuskeyid>",
views.edit_radiuskey, views.edit_radiuskey,
name="edit-radiuskey", name="edit-radiuskey",
), ),
url( path(
r"^del_radiuskey/(?P<radiuskeyid>[0-9]+)$", "del_radiuskey/<int:radiuskeyid>",
views.del_radiuskey, views.del_radiuskey,
name="del-radiuskey", name="del-radiuskey",
), ),
url( path(
r"^add_switchmanagementcred/$", "add_switchmanagementcred",
views.add_switchmanagementcred, views.add_switchmanagementcred,
name="add-switchmanagementcred", name="add-switchmanagementcred",
), ),
url( path(
r"^edit_switchmanagementcred/(?P<switchmanagementcredid>[0-9]+)$", "edit_switchmanagementcred/<int:switchmanagementcredid>",
views.edit_switchmanagementcred, views.edit_switchmanagementcred,
name="edit-switchmanagementcred", name="edit-switchmanagementcred",
), ),
url( path(
r"^del_switchmanagementcred/(?P<switchmanagementcredid>[0-9]+)$", "del_switchmanagementcred/<int:switchmanagementcredid>",
views.del_switchmanagementcred, views.del_switchmanagementcred,
name="del-switchmanagementcred", name="del-switchmanagementcred",
), ),
url( path(
r"^add_document_template/$", "add_document_template",
views.add_document_template, views.add_document_template,
name="add-document-template", name="add-document-template",
), ),
url( path(
r"^edit_document_template/(?P<documenttemplateid>[0-9]+)$", "edit_document_template/<int:documenttemplateid>",
views.edit_document_template, views.edit_document_template,
name="edit-document-template", name="edit-document-template",
), ),
url( path(
r"^del_document_template/$", "del_document_template",
views.del_document_template, views.del_document_template,
name="del-document-template", name="del-document-template",
), ),
url(r"^add_mandate/$", views.add_mandate, name="add-mandate"), path("add_mandate", views.add_mandate, name="add-mandate"),
url( path(
r"^edit_mandate/(?P<mandateid>[0-9]+)$", views.edit_mandate, name="edit-mandate" "edit_mandate/<int:mandateid>", views.edit_mandate, name="edit-mandate"
), ),
url(r"^del_mandate/(?P<mandateid>[0-9]+)$", views.del_mandate, name="del-mandate"), path("del_mandate/<int:mandateid>", views.del_mandate, name="del-mandate"),
url( path(
r"^add_radiusattribute/$", views.add_radiusattribute, name="add-radiusattribute" "add_radiusattribute", views.add_radiusattribute, name="add-radiusattribute"
), ),
url( path(
r"^edit_radiusattribute/(?P<radiusattributeid>[0-9]+)$", "edit_radiusattribute/<int:radiusattributeid>",
views.edit_radiusattribute, views.edit_radiusattribute,
name="edit-radiusattribute", name="edit-radiusattribute",
), ),
url( path(
r"^del_radiusattribute/(?P<radiusattributeid>[0-9]+)$", "del_radiusattribute/<int:radiusattributeid>",
views.del_radiusattribute, views.del_radiusattribute,
name="del-radiusattribute", name="del-radiusattribute",
), ),
url(r"^$", views.display_options, name="display-options"), path("", views.display_options, name="display-options"),
] ]

11
re2o/apps.py Normal file
View file

@ -0,0 +1,11 @@
"""
Configuration of re2o app.
"""
from django.apps import AppConfig
class Re2oConfig(AppConfig):
"""Configuration of re2o app."""
name = "re2o"

View file

@ -53,7 +53,7 @@ def context_user(request):
else: else:
if global_message not in [msg.message for msg in get_messages(request._request)]: if global_message not in [msg.message for msg in get_messages(request._request)]:
messages.warning(request._request, global_message) messages.warning(request._request, global_message)
if user.is_authenticated(): if user.is_authenticated:
interfaces = user.user_interfaces() interfaces = user.user_interfaces()
else: else:
interfaces = None interfaces = None

View file

@ -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 # 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 user:
if not (user.pwd_ntlm): if not (user.pwd_ntlm):
# if we dont have NT hash, we create it # if we dont have NT hash, we create it

View file

@ -84,16 +84,15 @@ LOCAL_APPS = (
INSTALLED_APPS = ( INSTALLED_APPS = (
EARLY_EXTERNAL_CONTRIB_APPS + DJANGO_CONTRIB_APPS + EXTERNAL_CONTRIB_APPS + LOCAL_APPS + OPTIONNAL_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.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware", "django.middleware.locale.LocaleMiddleware",
"django.middleware.common.CommonMiddleware", "django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware", "django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.auth.middleware.SessionAuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware", "django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
"django.middleware.security.SecurityMiddleware",
"reversion.middleware.RevisionMiddleware", "reversion.middleware.RevisionMiddleware",
) )
@ -195,6 +194,21 @@ GRAPH_MODELS = {"all_applications": True, "group_models": True}
# Timeout when sending emails through Django (in seconds) # Timeout when sending emails through Django (in seconds)
EMAIL_TIMEOUT = 10 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 # Activate API
if "api" in INSTALLED_APPS: if "api" in INSTALLED_APPS:
from api.settings import * from api.settings import *

View file

@ -382,7 +382,7 @@ class AclNode(Node):
def render(self, context): def render(self, context):
resolved_args = [arg.resolve(context) for arg in self.args] resolved_args = [arg.resolve(context) for arg in self.args]
if context["user"].is_anonymous(): if context["user"].is_anonymous:
can = False can = False
else: else:
can, _, _ = self.callback(context["user"], *(resolved_args)) can, _, _ = self.callback(context["user"], *(resolved_args))
@ -407,7 +407,7 @@ class AclInstanceNode(Node):
def render(self, context): def render(self, context):
callback = get_callback(self.tag_name, self.instance.resolve(context)) callback = get_callback(self.tag_name, self.instance.resolve(context))
resolved_args = [arg.resolve(context) for arg in self.args] resolved_args = [arg.resolve(context) for arg in self.args]
if context["user"].is_anonymous(): if context["user"].is_anonymous:
can = False can = False
else: else:
can, _, _ = callback(context["user"], *(resolved_args)) can, _, _ = callback(context["user"], *(resolved_args))

View file

@ -21,67 +21,47 @@
# with this program; if not, write to the Free Software Foundation, Inc., # with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # 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 __future__ import unicode_literals
from django.conf import settings 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.contrib import admin
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic import RedirectView from django.views.generic import RedirectView
from .settings_local import OPTIONNAL_APPS_RE2O 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 configuration
admin.site.index_title = _("Homepage") admin.site.index_title = _("Homepage")
admin.site.index_template = "admin/custom_index.html" admin.site.index_template = "admin/custom_index.html"
handler500 = "re2o.views.handler500" handler500 = handler500
handler404 = "re2o.views.handler404" handler404 = handler404
urlpatterns = [ urlpatterns = [
url(r"^$", index, name="index"), path("", index, name="index"),
url(r"^about/$", about_page, name="about"), path("about", about_page, name="about"),
url(r"^contact/$", contact_page, name="contact"), path("contact", contact_page, name="contact"),
url(r"^i18n/", include("django.conf.urls.i18n")), path("i18n/", include("django.conf.urls.i18n")),
url(r"^users/", include("users.urls", namespace="users")), path("users/", include("users.urls", namespace="users")),
url(r"^search/", include("search.urls", namespace="search")), path("search/", include("search.urls", namespace="search")),
url(r"^cotisations/", include("cotisations.urls", namespace="cotisations")), path("cotisations/", include("cotisations.urls", namespace="cotisations")),
url(r"^machines/", include("machines.urls", namespace="machines")), path("machines/", include("machines.urls", namespace="machines")),
url(r"^topologie/", include("topologie.urls", namespace="topologie")), path("topologie/", include("topologie.urls", namespace="topologie")),
url(r"^logs/", include("logs.urls", namespace="logs")), path("logs/", include("logs.urls", namespace="logs")),
url(r"^preferences/", include("preferences.urls", namespace="preferences")), path("preferences/", include("preferences.urls", namespace="preferences")),
# Include contrib auth and contrib admin # Include contrib auth and contrib admin
# manage/login/ is redirected to the non-admin login page # manage/login/ is redirected to the non-admin login page
url(r"^", include("django.contrib.auth.urls")), path("", include("django.contrib.auth.urls")),
url(r"^admin/login/$", RedirectView.as_view(pattern_name="login")), path("admin/login/", RedirectView.as_view(pattern_name="login")),
url(r"^admin/", include(admin.site.urls)), path("admin/", admin.site.urls),
] ]
urlpatterns += [ 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 for app in OPTIONNAL_APPS_RE2O
] ]
@ -89,6 +69,6 @@ urlpatterns += [
if "debug_toolbar" in settings.INSTALLED_APPS: if "debug_toolbar" in settings.INSTALLED_APPS:
import debug_toolbar import debug_toolbar
urlpatterns += [url(r"^__debug__/", include(debug_toolbar.urls))] urlpatterns += [path("__debug__/", include(debug_toolbar.urls))]
if "api" in settings.INSTALLED_APPS: if "api" in settings.INSTALLED_APPS:
urlpatterns += [url(r"^api/", include("api.urls", namespace="api"))] urlpatterns += [path("api/", include("api.urls", namespace="api"))]

View file

@ -168,7 +168,7 @@ def handler500(request):
return render(request, "errors/500.html", status=500) return render(request, "errors/500.html", status=500)
def handler404(request): def handler404(request, exception):
"""The handler view for a 404 error""" """The handler view for a 404 error"""
return render(request, "errors/404.html", status=404) return render(request, "errors/404.html", status=404)

11
search/apps.py Normal file
View file

@ -0,0 +1,11 @@
"""
Configuration of search app.
"""
from django.apps import AppConfig
class SearchConfig(AppConfig):
"""Configuration of search app."""
name = "search"

View file

@ -24,11 +24,13 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf.urls import url from django.urls import path
from . import views from . import views
app_name = "search"
urlpatterns = [ urlpatterns = [
url(r"^$", views.search, name="search"), path("", views.search, name="search"),
url(r"^advanced/$", views.searchp, name="searchp"), path("advanced", views.searchp, name="searchp"),
] ]

View file

@ -23,23 +23,25 @@
Tickets url Tickets url
""" """
from django.conf.urls import url from django.urls import path, re_path
from . import views from . import views
from .preferences.views import edit_options from .preferences.views import edit_options
app_name = "tickets"
urlpatterns = [ urlpatterns = [
url(r"^$", views.aff_tickets, name="aff-tickets"), path("", views.aff_tickets, name="aff-tickets"),
url(r"^(?P<ticketid>[0-9]+)$", views.aff_ticket, name="aff-ticket"), path("<int:ticketid>", views.aff_ticket, name="aff-ticket"),
url(r"^change_ticket_status/(?P<ticketid>[0-9]+)$", views.change_ticket_status, name="change-ticket-status"), path("change_ticket_status/<int:ticketid>", views.change_ticket_status, name="change-ticket-status"),
url(r"^edit_ticket/(?P<ticketid>[0-9]+)$", views.edit_ticket, name="edit-ticket"), path("edit_ticket/<int:ticketid>", views.edit_ticket, name="edit-ticket"),
url( re_path(
r"^edit_options/(?P<section>TicketOption)$", r"^edit_options/(?P<section>TicketOption)$",
edit_options, edit_options,
name="edit-options", name="edit-options",
), ),
url(r"^new_ticket/$", views.new_ticket, name="new-ticket"), path("new_ticket", views.new_ticket, name="new-ticket"),
url(r"^add_comment/(?P<ticketid>[0-9]+)$", views.add_comment, name="add-comment"), path("add_comment/<int:ticketid>", views.add_comment, name="add-comment"),
url(r"^edit_comment/(?P<commentticketid>[0-9]+)$", views.edit_comment, name="edit-comment"), path("edit_comment/<int:commentticketid>", views.edit_comment, name="edit-comment"),
url(r"^del_comment/(?P<commentticketid>[0-9]+)$", views.del_comment, name="del-comment"), path("del_comment/<int:commentticketid>", views.del_comment, name="del-comment"),
] ]

11
topologie/apps.py Normal file
View file

@ -0,0 +1,11 @@
"""
Configuration of topologie app.
"""
from django.apps import AppConfig
class TopologieConfig(AppConfig):
"""Configuration of topologie app."""
name = "topologie"

View file

@ -52,12 +52,12 @@ class Migration(migrations.Migration):
( (
"_content_type", "_content_type",
models.ForeignKey( models.ForeignKey(
null=True, blank=True, to="contenttypes.ContentType" null=True, blank=True, to="contenttypes.ContentType", on_delete=models.CASCADE
), ),
), ),
( (
"switch", "switch",
models.ForeignKey(related_name="ports", to="topologie.Switch"), models.ForeignKey(related_name="ports", to="topologie.Switch", on_delete=models.CASCADE),
), ),
], ],
), ),

View file

@ -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'),
),
]

View file

@ -35,7 +35,7 @@ class Migration(migrations.Migration):
model_name="port", model_name="port",
name="related", name="related",
field=models.OneToOneField( 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
), ),
) )
] ]

View file

@ -36,7 +36,7 @@ class Migration(migrations.Migration):
model_name="port", model_name="port",
name="related", name="related",
field=models.OneToOneField( 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
), ),
), ),
] ]

View file

@ -43,7 +43,7 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name="switch", model_name="switch",
name="switch_interface", 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, preserve_default=False,
), ),
migrations.AlterUniqueTogether(name="switch", unique_together=set([])), migrations.AlterUniqueTogether(name="switch", unique_together=set([])),

View file

@ -70,7 +70,6 @@ class Stack(AclMixin, RevMixin, models.Model):
member_id_max = models.PositiveIntegerField() member_id_max = models.PositiveIntegerField()
class Meta: class Meta:
permissions = (("view_stack", _("Can view a stack object")),)
verbose_name = _("switches stack") verbose_name = _("switches stack")
verbose_name_plural = _("switches stacks") verbose_name_plural = _("switches stacks")
@ -106,7 +105,6 @@ class AccessPoint(Machine):
) )
class Meta: class Meta:
permissions = (("view_accesspoint", _("Can view an access point object")),)
verbose_name = _("access point") verbose_name = _("access point")
verbose_name_plural = _("access points") verbose_name_plural = _("access points")
@ -282,7 +280,6 @@ class Switch(Machine):
class Meta: class Meta:
unique_together = ("stack", "stack_member_id") unique_together = ("stack", "stack_member_id")
permissions = (("view_switch", _("Can view a switch object")),)
verbose_name = _("switch") verbose_name = _("switch")
verbose_name_plural = _("switches") verbose_name_plural = _("switches")
@ -590,7 +587,6 @@ class ModelSwitch(AclMixin, RevMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_modelswitch", _("Can view a switch model object")),)
verbose_name = _("switch model") verbose_name = _("switch model")
verbose_name_plural = _("switch models") verbose_name_plural = _("switch models")
@ -623,7 +619,6 @@ class ModuleSwitch(AclMixin, RevMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_moduleswitch", _("Can view a switch module object")),)
verbose_name = _("switch module") verbose_name = _("switch module")
verbose_name_plural = _("switch modules") verbose_name_plural = _("switch modules")
@ -647,12 +642,6 @@ class ModuleOnSwitch(AclMixin, RevMixin, models.Model):
) )
class Meta: class Meta:
permissions = (
(
"view_moduleonswitch",
_("Can view a link between switch and module object"),
),
)
verbose_name = _("link between switch and module") verbose_name = _("link between switch and module")
verbose_name_plural = _("links between switch and module") verbose_name_plural = _("links between switch and module")
unique_together = ["slot", "switch"] unique_together = ["slot", "switch"]
@ -673,9 +662,6 @@ class ConstructorSwitch(AclMixin, RevMixin, models.Model):
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
class Meta: class Meta:
permissions = (
("view_constructorswitch", _("Can view a switch constructor object")),
)
verbose_name = _("switch constructor") verbose_name = _("switch constructor")
verbose_name_plural = _("switch constructors") 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) info = models.CharField(max_length=255, blank=True, null=True)
class Meta: class Meta:
permissions = (("view_switchbay", _("Can view a switch bay object")),)
verbose_name = _("switch bay") verbose_name = _("switch bay")
verbose_name_plural = _("switch bays") verbose_name_plural = _("switch bays")
@ -715,7 +700,6 @@ class Dormitory(AclMixin, RevMixin, models.Model):
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
class Meta: class Meta:
permissions = (("view_dormitory", _("Can view a dormitory object")),)
verbose_name = _("dormitory") verbose_name = _("dormitory")
verbose_name_plural = _("dormitories") verbose_name_plural = _("dormitories")
@ -764,7 +748,6 @@ class Building(AclMixin, RevMixin, models.Model):
dormitory = models.ForeignKey("Dormitory", on_delete=models.PROTECT) dormitory = models.ForeignKey("Dormitory", on_delete=models.PROTECT)
class Meta: class Meta:
permissions = (("view_building", _("Can view a building object")),)
verbose_name = _("building") verbose_name = _("building")
verbose_name_plural = _("buildings") 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 "machines.Interface", on_delete=models.SET_NULL, blank=True, null=True
) )
related = models.OneToOneField( 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( custom_profile = models.ForeignKey(
"PortProfile", on_delete=models.PROTECT, blank=True, null=True "PortProfile", on_delete=models.PROTECT, blank=True, null=True
@ -851,7 +834,6 @@ class Port(AclMixin, RevMixin, models.Model):
class Meta: class Meta:
unique_together = ("switch", "port") unique_together = ("switch", "port")
permissions = (("view_port", _("Can view a port object")),)
verbose_name = _("port") verbose_name = _("port")
verbose_name_plural = _("ports") verbose_name_plural = _("ports")
@ -971,7 +953,6 @@ class Room(AclMixin, RevMixin, models.Model):
class Meta: class Meta:
ordering = ["building__name"] ordering = ["building__name"]
permissions = (("view_room", _("Can view a room object")),)
verbose_name = _("room") verbose_name = _("room")
verbose_name_plural = _("rooms") verbose_name_plural = _("rooms")
unique_together = ("name", "building") unique_together = ("name", "building")
@ -1121,7 +1102,6 @@ class PortProfile(AclMixin, RevMixin, models.Model):
) )
class Meta: class Meta:
permissions = (("view_portprofile", _("Can view a port profile object")),)
verbose_name = _("port profile") verbose_name = _("port profile")
verbose_name_plural = _("port profiles") verbose_name_plural = _("port profiles")
unique_together = ["on_dormitory", "profil_default"] unique_together = ["on_dormitory", "profil_default"]

View file

@ -25,157 +25,159 @@ The defined URLs for topologie app. Included in re2o.urls.
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf.urls import url from django.urls import path
from . import views from . import views
from . import views_autocomplete from . import views_autocomplete
app_name = "topologie"
urlpatterns = [ urlpatterns = [
url(r"^$", views.index, name="index"), path("", views.index, name="index"),
url(r"^index_ap/$", views.index_ap, name="index-ap"), path("index_ap", views.index_ap, name="index-ap"),
url(r"^new_ap/$", views.new_ap, name="new-ap"), path("new_ap", views.new_ap, name="new-ap"),
url(r"^edit_ap/(?P<accesspointid>[0-9]+)$", views.edit_ap, name="edit-ap"), path("edit_ap/<int:accesspointid>", views.edit_ap, name="edit-ap"),
url( path(
r"^create_ports/(?P<switchid>[0-9]+)$", views.create_ports, name="create-ports" "create_ports/<int:switchid>", views.create_ports, name="create-ports"
), ),
url(r"^index_room/$", views.index_room, name="index-room"), path("index_room", views.index_room, name="index-room"),
url(r"^new_room/$", views.new_room, name="new-room"), path("new_room", views.new_room, name="new-room"),
url(r"^edit_room/(?P<roomid>[0-9]+)$", views.edit_room, name="edit-room"), path("edit_room/<int:roomid>", views.edit_room, name="edit-room"),
url(r"^del_room/(?P<roomid>[0-9]+)$", views.del_room, name="del-room"), path("del_room/<int:roomid>", views.del_room, name="del-room"),
url(r"^new_switch/$", views.new_switch, name="new-switch"), path("new_switch", views.new_switch, name="new-switch"),
url(r"^switch/(?P<switchid>[0-9]+)$", views.index_port, name="index-port"), path("switch/<int:switchid>", views.index_port, name="index-port"),
url(r"^edit_port/(?P<portid>[0-9]+)$", views.edit_port, name="edit-port"), path("edit_port/<int:portid>", views.edit_port, name="edit-port"),
url(r"^new_port/(?P<switchid>[0-9]+)$", views.new_port, name="new-port"), path("new_port/<int:switchid>", views.new_port, name="new-port"),
url(r"^del_port/(?P<portid>[0-9]+)$", views.del_port, name="del-port"), path("del_port/<int:portid>", views.del_port, name="del-port"),
url(r"^edit_switch/(?P<switchid>[0-9]+)$", views.edit_switch, name="edit-switch"), path("edit_switch/<int:switchid>", views.edit_switch, name="edit-switch"),
url(r"^new_stack/$", views.new_stack, name="new-stack"), path("new_stack", views.new_stack, name="new-stack"),
url( path(
r"^index_stack/$", "index_stack",
views.index_stack, views.index_stack,
name="index-stack", name="index-stack",
), ),
url( path(
r"^index_switch_bay/$", "index_switch_bay",
views.index_switch_bay, views.index_switch_bay,
name="index-switch-bay", name="index-switch-bay",
), ),
url( path(
r"^index_building/$", "index_building",
views.index_building, views.index_building,
name="index-building", name="index-building",
), ),
url( path(
r"^index_dormitory/$", "index_dormitory",
views.index_dormitory, views.index_dormitory,
name="index-dormitory", name="index-dormitory",
), ),
url(r"^edit_stack/(?P<stackid>[0-9]+)$", views.edit_stack, name="edit-stack"), path("edit_stack/<int:stackid>", views.edit_stack, name="edit-stack"),
url(r"^del_stack/(?P<stackid>[0-9]+)$", views.del_stack, name="del-stack"), path("del_stack/<int:stackid>", views.del_stack, name="del-stack"),
url(r"^index_model_switch/$", views.index_model_switch, name="index-model-switch"), path("index_model_switch", views.index_model_switch, name="index-model-switch"),
url(r"^index_model_switch/$", views.index_model_switch, name="index-model-switch"), path("index_model_switch", views.index_model_switch, name="index-model-switch"),
url(r"^new_model_switch/$", views.new_model_switch, name="new-model-switch"), path("new_model_switch", views.new_model_switch, name="new-model-switch"),
url( path(
r"^edit_model_switch/(?P<modelswitchid>[0-9]+)$", "edit_model_switch/<int:modelswitchid>",
views.edit_model_switch, views.edit_model_switch,
name="edit-model-switch", name="edit-model-switch",
), ),
url( path(
r"^del_model_switch/(?P<modelswitchid>[0-9]+)$", "del_model_switch/<int:modelswitchid>",
views.del_model_switch, views.del_model_switch,
name="del-model-switch", name="del-model-switch",
), ),
url( path(
r"^new_constructor_switch/$", "new_constructor_switch",
views.new_constructor_switch, views.new_constructor_switch,
name="new-constructor-switch", name="new-constructor-switch",
), ),
url( path(
r"^edit_constructor_switch/(?P<constructorswitchid>[0-9]+)$", "edit_constructor_switch/<int:constructorswitchid>",
views.edit_constructor_switch, views.edit_constructor_switch,
name="edit-constructor-switch", name="edit-constructor-switch",
), ),
url( path(
r"^del_constructor_switch/(?P<constructorswitchid>[0-9]+)$", "del_constructor_switch/<int:constructorswitchid>",
views.del_constructor_switch, views.del_constructor_switch,
name="del-constructor-switch", name="del-constructor-switch",
), ),
url(r"^new_switch_bay/$", views.new_switch_bay, name="new-switch-bay"), path("new_switch_bay", views.new_switch_bay, name="new-switch-bay"),
url( path(
r"^edit_switch_bay/(?P<switchbayid>[0-9]+)$", "edit_switch_bay/<int:switchbayid>",
views.edit_switch_bay, views.edit_switch_bay,
name="edit-switch-bay", name="edit-switch-bay",
), ),
url( path(
r"^del_switch_bay/(?P<switchbayid>[0-9]+)$", "del_switch_bay/<int:switchbayid>",
views.del_switch_bay, views.del_switch_bay,
name="del-switch-bay", name="del-switch-bay",
), ),
url(r"^new_building/$", views.new_building, name="new-building"), path("new_building", views.new_building, name="new-building"),
url( path(
r"^edit_building/(?P<buildingid>[0-9]+)$", "edit_building/<int:buildingid>",
views.edit_building, views.edit_building,
name="edit-building", name="edit-building",
), ),
url( path(
r"^del_building/(?P<buildingid>[0-9]+)$", "del_building/<int:buildingid>",
views.del_building, views.del_building,
name="del-building", name="del-building",
), ),
url(r"^new_dormitory/$", views.new_dormitory, name="new-dormitory"), path("new_dormitory", views.new_dormitory, name="new-dormitory"),
url( path(
r"^edit_dormitory/(?P<dormitoryid>[0-9]+)$", "edit_dormitory/<int:dormitoryid>",
views.edit_dormitory, views.edit_dormitory,
name="edit-dormitory", name="edit-dormitory",
), ),
url( path(
r"^del_dormitory/(?P<dormitoryid>[0-9]+)$", "del_dormitory/<int:dormitoryid>",
views.del_dormitory, views.del_dormitory,
name="del-dormitory", name="del-dormitory",
), ),
url(r"^index_port_profile/$", views.index_port_profile, name="index-port-profile"), path("index_port_profile", views.index_port_profile, name="index-port-profile"),
url(r"^new_port_profile/$", views.new_port_profile, name="new-port-profile"), path("new_port_profile", views.new_port_profile, name="new-port-profile"),
url( path(
r"^edit_port_profile/(?P<portprofileid>[0-9]+)$", "edit_port_profile/<int:portprofileid>",
views.edit_port_profile, views.edit_port_profile,
name="edit-port-profile", name="edit-port-profile",
), ),
url( path(
r"^del_port_profile/(?P<portprofileid>[0-9]+)$", "del_port_profile/<int:portprofileid>",
views.del_port_profile, views.del_port_profile,
name="del-port-profile", name="del-port-profile",
), ),
url( path(
r"^edit_vlanoptions/(?P<vlanid>[0-9]+)$", "edit_vlanoptions/<int:vlanid>",
views.edit_vlanoptions, views.edit_vlanoptions,
name="edit-vlanoptions", name="edit-vlanoptions",
), ),
url(r"^add_module/$", views.add_module, name="add-module"), path("add_module", views.add_module, name="add-module"),
url( path(
r"^edit_module/(?P<moduleswitchid>[0-9]+)$", "edit_module/<int:moduleswitchid>",
views.edit_module, views.edit_module,
name="edit-module", name="edit-module",
), ),
url( path(
r"^del_module/(?P<moduleswitchid>[0-9]+)$", views.del_module, name="del-module" "del_module/<int:moduleswitchid>", views.del_module, name="del-module"
), ),
url(r"^index_module/$", views.index_module, name="index-module"), path("index_module", views.index_module, name="index-module"),
url(r"^add_module_on/$", views.add_module_on, name="add-module-on"), path("add_module_on", views.add_module_on, name="add-module-on"),
url( path(
r"^edit_module_on/(?P<moduleonswitchid>[0-9]+)$", "edit_module_on/<int:moduleonswitchid>",
views.edit_module_on, views.edit_module_on,
name="edit-module-on", name="edit-module-on",
), ),
url( path(
r"^del_module_on/(?P<moduleonswitchid>[0-9]+)$", "del_module_on/<int:moduleonswitchid>",
views.del_module_on, views.del_module_on,
name="del-module-on", name="del-module-on",
), ),
### Autocomplete Views ### Autocomplete Views
url(r'^room-autocomplete/$', views_autocomplete.RoomAutocomplete.as_view(), name='room-autocomplete',), path('room-autocomplete', views_autocomplete.RoomAutocomplete.as_view(), name='room-autocomplete',),
url(r'^building-autocomplete/$', views_autocomplete.BuildingAutocomplete.as_view(), name='building-autocomplete',), path('building-autocomplete', views_autocomplete.BuildingAutocomplete.as_view(), name='building-autocomplete',),
url(r'^dormitory-autocomplete/$', views_autocomplete.DormitoryAutocomplete.as_view(), name='dormitory-autocomplete',), path('dormitory-autocomplete', views_autocomplete.DormitoryAutocomplete.as_view(), name='dormitory-autocomplete',),
url(r'^switch-autocomplete/$', views_autocomplete.SwitchAutocomplete.as_view(), name='switch-autocomplete',), path('switch-autocomplete', views_autocomplete.SwitchAutocomplete.as_view(), name='switch-autocomplete',),
url(r'^port-autocomplete/$', views_autocomplete.PortAutocomplete.as_view(), name='profile-autocomplete',), path('port-autocomplete', views_autocomplete.PortAutocomplete.as_view(), name='profile-autocomplete',),
url(r'^portprofile-autocomplete/$', views_autocomplete.PortProfileAutocomplete.as_view(), name='portprofile-autocomplete',), path('portprofile-autocomplete', views_autocomplete.PortProfileAutocomplete.as_view(), name='portprofile-autocomplete',),
url(r'^switchbay-autocomplete/$', views_autocomplete.SwitchBayAutocomplete.as_view(), name='switchbay-autocomplete',), path('switchbay-autocomplete', views_autocomplete.SwitchBayAutocomplete.as_view(), name='switchbay-autocomplete',),
] ]

11
users/apps.py Normal file
View file

@ -0,0 +1,11 @@
"""
Configuration of users app.
"""
from django.apps import AppConfig
class CoreConfig(AppConfig):
"""Configuration of users app."""
name = "users"

View file

@ -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()),
],
),
]

View file

@ -57,7 +57,7 @@ from django.db.models.signals import post_save, post_delete, m2m_changed
from django.dispatch import receiver from django.dispatch import receiver
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.template import loader from django.template import loader
from django.core.urlresolvers import reverse from django.urls import reverse
from django.db import transaction from django.db import transaction
from django.utils import timezone from django.utils import timezone
from datetime import timedelta from datetime import timedelta
@ -319,7 +319,6 @@ class User(
_("Can edit the groups of rights of a user (critical permission)"), _("Can edit the groups of rights of a user (critical permission)"),
), ),
("change_all_users", _("Can edit all users, including those with rights")), ("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 = _("user (member or club)")
verbose_name_plural = _("users (members or clubs)") verbose_name_plural = _("users (members or clubs)")
@ -2161,7 +2160,6 @@ class ServiceUser(RevMixin, AclMixin, AbstractBaseUser):
objects = UserManager() objects = UserManager()
class Meta: class Meta:
permissions = (("view_serviceuser", _("Can view a service user object")),)
verbose_name = _("service user") verbose_name = _("service user")
verbose_name_plural = _("service users") verbose_name_plural = _("service users")
@ -2218,7 +2216,6 @@ class School(RevMixin, AclMixin, models.Model):
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
class Meta: class Meta:
permissions = (("view_school", _("Can view a school object")),)
verbose_name = _("school") verbose_name = _("school")
verbose_name_plural = _("schools") verbose_name_plural = _("schools")
@ -2272,7 +2269,6 @@ class ListRight(RevMixin, AclMixin, Group):
details = models.CharField(help_text=_("Description."), max_length=255, blank=True) details = models.CharField(help_text=_("Description."), max_length=255, blank=True)
class Meta: class Meta:
permissions = (("view_listright", _("Can view a group of rights object")),)
verbose_name = _("group of rights") verbose_name = _("group of rights")
verbose_name_plural = _("groups 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) shell = models.CharField(max_length=255, unique=True)
class Meta: class Meta:
permissions = (("view_listshell", _("Can view a shell object")),)
verbose_name = _("shell") verbose_name = _("shell")
verbose_name_plural = _("shells") verbose_name_plural = _("shells")
@ -2378,7 +2373,6 @@ class Ban(RevMixin, AclMixin, models.Model):
request = None request = None
class Meta: class Meta:
permissions = (("view_ban", _("Can view a ban object")),)
verbose_name = _("ban") verbose_name = _("ban")
verbose_name_plural = _("bans") verbose_name_plural = _("bans")
@ -2495,7 +2489,6 @@ class Whitelist(RevMixin, AclMixin, models.Model):
date_end = models.DateTimeField() date_end = models.DateTimeField()
class Meta: class Meta:
permissions = (("view_whitelist", _("Can view a whitelist object")),)
verbose_name = _("whitelist (free of charge access)") verbose_name = _("whitelist (free of charge access)")
verbose_name_plural = _("whitelists (free of charge access)") verbose_name_plural = _("whitelists (free of charge access)")
@ -2617,9 +2610,6 @@ class EMailAddress(RevMixin, AclMixin, models.Model):
) )
class Meta: class Meta:
permissions = (
("view_emailaddress", _("Can view a local email account object")),
)
verbose_name = _("local email account") verbose_name = _("local email account")
verbose_name_plural = _("local email accounts") verbose_name_plural = _("local email accounts")

View file

@ -28,111 +28,113 @@ The defined URLs for the Users app
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf.urls import url from django.urls import path, re_path
from . import views from . import views
from . import views_autocomplete from . import views_autocomplete
app_name = "users"
urlpatterns = [ urlpatterns = [
url(r"^new_user/$", views.new_user, name="new-user"), path("new_user", views.new_user, name="new-user"),
url(r"^new_club/$", views.new_club, name="new-club"), path("new_club", views.new_club, name="new-club"),
url(r"^edit_info/(?P<userid>[0-9]+)$", views.edit_info, name="edit-info"), path("edit_info/<int:userid>", views.edit_info, name="edit-info"),
url( path(
r"^edit_club_admin_members/(?P<clubid>[0-9]+)$", "edit_club_admin_members/<int:clubid>",
views.edit_club_admin_members, views.edit_club_admin_members,
name="edit-club-admin-members", name="edit-club-admin-members",
), ),
url(r"^state/(?P<userid>[0-9]+)$", views.state, name="state"), path("state/<int:userid>", views.state, name="state"),
url(r"^groups/(?P<userid>[0-9]+)$", views.groups, name="groups"), path("groups/<int:userid>", views.groups, name="groups"),
url(r"^password/(?P<userid>[0-9]+)$", views.password, name="password"), path("password/<int:userid>", views.password, name="password"),
url(r"^confirm_email/(?P<userid>[0-9]+)$", views.resend_confirmation_email, name="resend-confirmation-email"), path("confirm_email/<int:userid>", views.resend_confirmation_email, name="resend-confirmation-email"),
url( path(
r"^del_group/(?P<userid>[0-9]+)/(?P<listrightid>[0-9]+)$", "del_group/<int:userid>/<int:listrightid>",
views.del_group, views.del_group,
name="del-group", name="del-group",
), ),
url( path(
r"^del_superuser/(?P<userid>[0-9]+)$", views.del_superuser, name="del-superuser" "del_superuser/<int:userid>", views.del_superuser, name="del-superuser"
), ),
url(r"^new_serviceuser/$", views.new_serviceuser, name="new-serviceuser"), path("new_serviceuser", views.new_serviceuser, name="new-serviceuser"),
url( path(
r"^edit_serviceuser/(?P<serviceuserid>[0-9]+)$", "edit_serviceuser/<int:serviceuserid>",
views.edit_serviceuser, views.edit_serviceuser,
name="edit-serviceuser", name="edit-serviceuser",
), ),
url( path(
r"^del_serviceuser/(?P<serviceuserid>[0-9]+)$", "del_serviceuser/<int:serviceuserid>",
views.del_serviceuser, views.del_serviceuser,
name="del-serviceuser", name="del-serviceuser",
), ),
url(r"^add_ban/(?P<userid>[0-9]+)$", views.add_ban, name="add-ban"), path("add_ban/<int:userid>", views.add_ban, name="add-ban"),
url(r"^edit_ban/(?P<banid>[0-9]+)$", views.edit_ban, name="edit-ban"), path("edit_ban/<int:banid>", views.edit_ban, name="edit-ban"),
url(r"^del-ban/(?P<banid>[0-9]+)$", views.del_ban, name="del-ban"), path("del-ban/<int:banid>", views.del_ban, name="del-ban"),
url( path(
r"^add_whitelist/(?P<userid>[0-9]+)$", views.add_whitelist, name="add-whitelist" "add_whitelist/<int:userid>", views.add_whitelist, name="add-whitelist"
), ),
url( path(
r"^edit_whitelist/(?P<whitelistid>[0-9]+)$", "edit_whitelist/<int:whitelistid>",
views.edit_whitelist, views.edit_whitelist,
name="edit-whitelist", name="edit-whitelist",
), ),
url( path(
r"^del_whitelist/(?P<whitelistid>[0-9]+)$", "del_whitelist/<int:whitelistid>",
views.del_whitelist, views.del_whitelist,
name="del-whitelist", name="del-whitelist",
), ),
url( path(
r"^add_emailaddress/(?P<userid>[0-9]+)$", "add_emailaddress/<int:userid>",
views.add_emailaddress, views.add_emailaddress,
name="add-emailaddress", name="add-emailaddress",
), ),
url( path(
r"^edit_emailaddress/(?P<emailaddressid>[0-9]+)$", "edit_emailaddress/<int:emailaddressid>",
views.edit_emailaddress, views.edit_emailaddress,
name="edit-emailaddress", name="edit-emailaddress",
), ),
url( path(
r"^del_emailaddress/(?P<emailaddressid>[0-9]+)$", "del_emailaddress/<int:emailaddressid>",
views.del_emailaddress, views.del_emailaddress,
name="del-emailaddress", name="del-emailaddress",
), ),
url( path(
r"^edit_email_settings/(?P<userid>[0-9]+)$", "edit_email_settings/<int:userid>",
views.edit_email_settings, views.edit_email_settings,
name="edit-email-settings", name="edit-email-settings",
), ),
url(r"^add_school/$", views.add_school, name="add-school"), path("add_school", views.add_school, name="add-school"),
url(r"^edit_school/(?P<schoolid>[0-9]+)$", views.edit_school, name="edit-school"), path("edit_school/<int:schoolid>", views.edit_school, name="edit-school"),
url(r"^del_school/$", views.del_school, name="del-school"), path("del_school", views.del_school, name="del-school"),
url(r"^add_listright/$", views.add_listright, name="add-listright"), path("add_listright", views.add_listright, name="add-listright"),
url( path(
r"^edit_listright/(?P<listrightid>[0-9]+)$", "edit_listright/<int:listrightid>",
views.edit_listright, views.edit_listright,
name="edit-listright", name="edit-listright",
), ),
url(r"^del_listright/$", views.del_listright, name="del-listright"), path("del_listright", views.del_listright, name="del-listright"),
url(r"^add_shell/$", views.add_shell, name="add-shell"), path("add_shell", views.add_shell, name="add-shell"),
url(r"^edit_shell/(?P<listshellid>[0-9]+)$", views.edit_shell, name="edit-shell"), path("edit_shell/<int:listshellid>", views.edit_shell, name="edit-shell"),
url(r"^del_shell/(?P<listshellid>[0-9]+)$", views.del_shell, name="del-shell"), path("del_shell/<int:listshellid>", views.del_shell, name="del-shell"),
url(r"^profil/(?P<userid>[0-9]+)$", views.profil, name="profil"), path("profil/<int:userid>", views.profil, name="profil"),
url(r"^index_ban/$", views.index_ban, name="index-ban"), path("index_ban", views.index_ban, name="index-ban"),
url(r"^index_white/$", views.index_white, name="index-white"), path("index_white", views.index_white, name="index-white"),
url(r"^index_school/$", views.index_school, name="index-school"), path("index_school", views.index_school, name="index-school"),
url(r"^index_shell/$", views.index_shell, name="index-shell"), path("index_shell", views.index_shell, name="index-shell"),
url(r"^index_listright/$", views.index_listright, name="index-listright"), path("index_listright", views.index_listright, name="index-listright"),
url(r"^index_serviceusers/$", views.index_serviceusers, name="index-serviceusers"), path("index_serviceusers", views.index_serviceusers, name="index-serviceusers"),
url(r"^mon_profil/$", views.mon_profil, name="mon-profil"), path("mon_profil", views.mon_profil, name="mon-profil"),
url(r"^process/(?P<token>[a-z0-9]{32})/$", views.process, name="process"), re_path(r"^process/(?P<token>[a-z0-9]{32})/$", views.process, name="process"),
url(r"^reset_password/$", views.reset_password, name="reset-password"), path("reset_password", views.reset_password, name="reset-password"),
url(r"^mass_archive/$", views.mass_archive, name="mass-archive"), path("mass_archive", views.mass_archive, name="mass-archive"),
url(r"^$", views.index, name="index"), path("", views.index, name="index"),
url(r"^index_clubs/$", views.index_clubs, name="index-clubs"), path("index_clubs", views.index_clubs, name="index-clubs"),
url(r"^initial_register/$", views.initial_register, name="initial-register"), path("initial_register", views.initial_register, name="initial-register"),
url(r"^edit_theme/(?P<userid>[0-9]+)$", views.edit_theme, name="edit-theme"), path("edit_theme/<int:userid>", views.edit_theme, name="edit-theme"),
### Autocomplete Views ### Autocomplete Views
url(r'^user-autocomplete/$', views_autocomplete.UserAutocomplete.as_view(), name='user-autocomplete',), path('user-autocomplete', views_autocomplete.UserAutocomplete.as_view(), name='user-autocomplete',),
url(r'^adherent-autocomplete/$', views_autocomplete.AdherentAutocomplete.as_view(), name='adherent-autocomplete',), path('adherent-autocomplete', views_autocomplete.AdherentAutocomplete.as_view(), name='adherent-autocomplete',),
url(r'^club-autocomplete/$', views_autocomplete.ClubAutocomplete.as_view(), name='club-autocomplete',), path('club-autocomplete', views_autocomplete.ClubAutocomplete.as_view(), name='club-autocomplete',),
url(r'^school-autocomplete/$', views_autocomplete.SchoolAutocomplete.as_view(), name='school-autocomplete',), path('school-autocomplete', views_autocomplete.SchoolAutocomplete.as_view(), name='school-autocomplete',),
url(r'^shell-autocomplete/$', views_autocomplete.ShellAutocomplete.as_view(), name='shell-autocomplete',), path('shell-autocomplete', views_autocomplete.ShellAutocomplete.as_view(), name='shell-autocomplete',),
] ]