Commit 56a07f3f authored by Baptiste Jonglez's avatar Baptiste Jonglez Committed by jocelyn

Implement a crude user interface for DSL lines

parent fa48fe51
{% extends "base.html" %}
{% load subnets %}
{% block content %}
<div class="row">
<form action="" method="post">{% csrf_token %}
{% for message in messages %}
<div class="message{% if message.tags %} {{ message.tags }}{% endif %}">
{{ message }}
</div>
{% endfor %}
{{ form.non_field_errors }}
<div>Numéro de téléphone : {{ object.phone_number }}</div>
<div>Identifiant ADSL : {{ object.full_login }}</div>
<div>
{{ form.password.errors }}
{{ form.password.label_tag }}
{{ form.password }}
Mettre un mot de passe vide pour en générer un nouveau automatiquement
</div>
<div>État : {{ object.activated|yesno:"activé,désactivé" }}</div>
<div>Blocs IP :
<ul>
{% for subnet in object.ip_subnet.all %}
<li>{{ subnet|prettify }}</li>
{% endfor %}
</ul></div>
<input type="submit" value="Mettre à jour" />
</form>
</div>
{% endblock %}
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import patterns, url
from .views import DSLView
urlpatterns = patterns(
'',
# This is part of the generic configuration interface (the "name" is
# the same as the "backend_name" of the model).
url(r'^(?P<pk>\d+)$', DSLView.as_view(template_name="dsl_ldap/dsl.html"),
name="details")
)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.shortcuts import get_object_or_404
from django.views.generic.edit import UpdateView
from django.contrib.auth.decorators import login_required
from django.contrib.messages.views import SuccessMessageMixin
from django.utils.decorators import method_decorator
# Create your views here.
from .models import DSLConfiguration
class DSLView(SuccessMessageMixin, UpdateView):
model = DSLConfiguration
fields = ['password']
success_message = "Configuration enregistrée avec succès !"
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(DSLView, self).dispatch(*args, **kwargs)
def get_object(self):
if self.request.user.is_superuser:
return get_object_or_404(DSLConfiguration, pk=self.kwargs.get("pk"))
# For normal users, ensure the VPN belongs to them.
return get_object_or_404(DSLConfiguration, pk=self.kwargs.get("pk"),
offersubscription__member=self.request.user)
......@@ -37,7 +37,6 @@ urlpatterns = patterns(
url(r'^members/', include('coin.members.urls', namespace='members')),
url(r'^billing/', include('coin.billing.urls', namespace='billing')),
url(r'^subscription/', include('coin.offers.urls', namespace='subscription')),
url(r'^admin/', include(admin.site.urls)),
url(r'^hijack/', include('hijack.urls', namespace='hijack')),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment