diff --git a/account/forms.py b/account/forms.py index d51623d..376002b 100644 --- a/account/forms.py +++ b/account/forms.py @@ -43,3 +43,6 @@ class RFIDForm(forms.Form): 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')) diff --git a/account/templates/form_base.html b/account/templates/form_base.html index 1000011..5b8727f 100644 --- a/account/templates/form_base.html +++ b/account/templates/form_base.html @@ -8,7 +8,7 @@ {% block form_description %}{% endblock %} {% if message %} -
{{ message }}
+
{{ message }}
{% endif %} {% block form_fields %}{% endblock form_fields %} diff --git a/account/templates/nrf24.html b/account/templates/nrf24.html new file mode 100644 index 0000000..458877a --- /dev/null +++ b/account/templates/nrf24.html @@ -0,0 +1,23 @@ +{% extends "form_base.html" %} +{% load i18n %} +{% load crispy_forms_tags %} + +{% block form_title %}{% trans "NRF24"%}{% endblock %} + +{% block form_description %} +

{% blocktrans %}The NRF24 identification is used for your R0K3T!{% endblocktrans %}

+{% endblock %} + +{% block form_fields %} + {{ form.non_field_errors }} +
+ {% csrf_token %} + {{ form|crispy }} + +
+
+ +
+
+
+{% endblock form_fields %} \ No newline at end of file diff --git a/account/urls.py b/account/urls.py index 0f3d722..755e7f5 100644 --- a/account/urls.py +++ b/account/urls.py @@ -8,5 +8,6 @@ urlpatterns = patterns( url(r'^gastropin/$', 'account.views.gastropin', name='gastropin'), url(r'^wlan_presence/$', 'account.views.wlan_presence', name='wlan_presence'), url(r'^rfid/$', 'account.views.rfid', name='rfid'), + url(r'^nrf24/$', 'account.views.nrf24', name='rfid'), url(r'^groups/(?P[^/]+)/', 'account.views.groups_list'), ) \ No newline at end of file diff --git a/account/views.py b/account/views.py index 90f8c64..4dd1fa2 100644 --- a/account/views.py +++ b/account/views.py @@ -12,7 +12,8 @@ from django.contrib.auth.models import Group from django.shortcuts import render 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 def auth_login(request): @@ -95,6 +96,9 @@ def gastropin(request): def set_ldap_field(request, form_type, field_names, template_name): + """ + Abstract view for each of the different forms. + """ member = retrieve_member(request) initial = {} @@ -118,7 +122,6 @@ def set_ldap_field(request, form_type, field_names, template_name): form = form_type(initial=initial) return render(request, template_name, {'form': form}) - @login_required def wlan_presence(request): return set_ldap_field(request, WlanPresenceForm, @@ -128,4 +131,8 @@ def wlan_presence(request): def rfid(request): 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') + diff --git a/cbmi/templates/base.html b/cbmi/templates/base.html index 6cf6ce6..0b8a608 100644 --- a/cbmi/templates/base.html +++ b/cbmi/templates/base.html @@ -77,6 +77,10 @@
  • {% trans "RFID" %}
  • + {% url account.views.nrf24 as nrf24_url %} +
  • + {% trans "NRF24" %} +
  • {% block container %}
    diff --git a/cbmi/urls.py b/cbmi/urls.py index b6efca6..10bebbb 100644 --- a/cbmi/urls.py +++ b/cbmi/urls.py @@ -11,6 +11,6 @@ urlpatterns = patterns('', url(r'account/', include('account.urls')), - url(r'^$', 'cbmi.views.landingpage'), + url(r'^$', 'account.views.landingpage'), ) diff --git a/cbmi/views.py b/cbmi/views.py index 2360549..7a5526d 100644 --- a/cbmi/views.py +++ b/cbmi/views.py @@ -1,4 +1,5 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Create your views here \ No newline at end of file +# Create your views here +