added nrf24 form and changed message color to blue
This commit is contained in:
parent
8fdc6064fa
commit
413728b24f
8 changed files with 44 additions and 5 deletions
|
|
@ -43,3 +43,6 @@ class RFIDForm(forms.Form):
|
||||||
rfid = forms.CharField(max_length=255, help_text=_('Your RFID'))
|
rfid = forms.CharField(max_length=255, help_text=_('Your RFID'))
|
||||||
|
|
||||||
|
|
||||||
|
class NRF24Form(forms.Form):
|
||||||
|
nrf24 = forms.CharField(max_length=255,
|
||||||
|
help_text=_('Your NRF24 identification'))
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
{% block form_description %}{% endblock %}
|
{% block form_description %}{% endblock %}
|
||||||
|
|
||||||
{% if message %}
|
{% if message %}
|
||||||
<div class="alert alert-success">{{ message }}</div>
|
<div class="alert alert-info">{{ message }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% block form_fields %}{% endblock form_fields %}
|
{% block form_fields %}{% endblock form_fields %}
|
||||||
|
|
|
||||||
23
account/templates/nrf24.html
Normal file
23
account/templates/nrf24.html
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{% extends "form_base.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block form_title %}{% trans "NRF24"%}{% endblock %}
|
||||||
|
|
||||||
|
{% block form_description %}
|
||||||
|
<p>{% blocktrans %}The NRF24 identification is used for your R0K3T!{% endblocktrans %}</p>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block form_fields %}
|
||||||
|
{{ form.non_field_errors }}
|
||||||
|
<form action="{% url account.views.nrf24 %}" method="post" class="form-horizontal well">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endblock form_fields %}
|
||||||
|
|
@ -8,5 +8,6 @@ urlpatterns = patterns(
|
||||||
url(r'^gastropin/$', 'account.views.gastropin', name='gastropin'),
|
url(r'^gastropin/$', 'account.views.gastropin', name='gastropin'),
|
||||||
url(r'^wlan_presence/$', 'account.views.wlan_presence', name='wlan_presence'),
|
url(r'^wlan_presence/$', 'account.views.wlan_presence', name='wlan_presence'),
|
||||||
url(r'^rfid/$', 'account.views.rfid', name='rfid'),
|
url(r'^rfid/$', 'account.views.rfid', name='rfid'),
|
||||||
|
url(r'^nrf24/$', 'account.views.nrf24', name='rfid'),
|
||||||
url(r'^groups/(?P<group_name>[^/]+)/', 'account.views.groups_list'),
|
url(r'^groups/(?P<group_name>[^/]+)/', 'account.views.groups_list'),
|
||||||
)
|
)
|
||||||
|
|
@ -12,7 +12,8 @@ from django.contrib.auth.models import Group
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from forms import GastroPinForm, WlanPresenceForm, LoginForm, PaswordForm, RFIDForm
|
from forms import GastroPinForm, WlanPresenceForm, LoginForm, PaswordForm, \
|
||||||
|
RFIDForm, NRF24Form
|
||||||
from cbase_members import MemberValues, retrieve_member
|
from cbase_members import MemberValues, retrieve_member
|
||||||
|
|
||||||
def auth_login(request):
|
def auth_login(request):
|
||||||
|
|
@ -95,6 +96,9 @@ def gastropin(request):
|
||||||
|
|
||||||
|
|
||||||
def set_ldap_field(request, form_type, field_names, template_name):
|
def set_ldap_field(request, form_type, field_names, template_name):
|
||||||
|
"""
|
||||||
|
Abstract view for each of the different forms.
|
||||||
|
"""
|
||||||
member = retrieve_member(request)
|
member = retrieve_member(request)
|
||||||
initial = {}
|
initial = {}
|
||||||
|
|
||||||
|
|
@ -118,7 +122,6 @@ def set_ldap_field(request, form_type, field_names, template_name):
|
||||||
form = form_type(initial=initial)
|
form = form_type(initial=initial)
|
||||||
return render(request, template_name, {'form': form})
|
return render(request, template_name, {'form': form})
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def wlan_presence(request):
|
def wlan_presence(request):
|
||||||
return set_ldap_field(request, WlanPresenceForm,
|
return set_ldap_field(request, WlanPresenceForm,
|
||||||
|
|
@ -128,4 +131,8 @@ def wlan_presence(request):
|
||||||
def rfid(request):
|
def rfid(request):
|
||||||
return set_ldap_field(request, RFIDForm, [('rfid', 'rfid')], 'rfid.html')
|
return set_ldap_field(request, RFIDForm, [('rfid', 'rfid')], 'rfid.html')
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def nrf24(request):
|
||||||
|
return set_ldap_field(request, NRF24Form, [('nrf24', 'nrf24')], 'nrf24.html')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,10 @@
|
||||||
<li class="{% if request.path == rfid_url %}active{% endif %}">
|
<li class="{% if request.path == rfid_url %}active{% endif %}">
|
||||||
<a href="{{ rfid_url }}">{% trans "RFID" %}</a>
|
<a href="{{ rfid_url }}">{% trans "RFID" %}</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% url account.views.nrf24 as nrf24_url %}
|
||||||
|
<li class="{% if request.path == nrf24_url %}active{% endif %}">
|
||||||
|
<a href="{{ nrf24_url }}">{% trans "NRF24" %}</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% block container %}
|
{% block container %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,6 @@ urlpatterns = patterns('',
|
||||||
|
|
||||||
url(r'account/', include('account.urls')),
|
url(r'account/', include('account.urls')),
|
||||||
|
|
||||||
url(r'^$', 'cbmi.views.landingpage'),
|
url(r'^$', 'account.views.landingpage'),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Create your views here
|
# Create your views here
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue