fixed different width in templates

This commit is contained in:
Fabian Faessler 2013-09-29 00:28:31 +02:00
parent 884c86defd
commit 553e02f243
6 changed files with 35 additions and 25 deletions

View File

@ -5,9 +5,9 @@ from django.forms import ModelForm
class Host(models.Model):
"""TODO: hash update_secret"""
fqdn = models.CharField(max_length=256)
fqdn = models.CharField(max_length=256,unique=True)
update_secret = models.CharField(max_length=256)
comment = models.CharField(max_length=256,default='')
comment = models.CharField(max_length=256,default='',blank=True, null=True)
last_update = models.DateTimeField(auto_now=True)
created = models.DateTimeField(auto_now_add=True)

View File

@ -4,7 +4,6 @@
{% block content %}
<div class="row">
<div class="col-lg-4">
<h3>Delete Host <small><a href="{% url 'overview' %}"><i class="icon-double-angle-left"></i> back to overview</a></small></h3>
<form action="" method="post">

View File

@ -23,8 +23,8 @@
{% endfor %}
</table>
</div>
<h3>New host</h3>
<div class="col-lg-4">
<h3>New host</h3>
<form method="post" action="">
{% csrf_token %}
{{ form|bootstrap }}
@ -33,13 +33,11 @@
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h3>Information</h3>
<b>your IPv4:</b> <span class="ipv4adr">{{ request.session.ipv4 }}</span> </br>
<b>your IPv6:</b> <span class="ipv6adr">{{ request.session.ipv6 }}</span>
</div>
<div style="display: none">
<img src="//{{ WWW_IPV4_HOST }}/updateip" />
<img src="//{{ WWW_IPV6_HOST }}/updateip" />
</div>
{% endblock %}

View File

@ -9,6 +9,7 @@ from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.utils.decorators import method_decorator
from django.core.urlresolvers import reverse
import dns.inet
from main.forms import HostForm
from main.models import Host
@ -19,8 +20,11 @@ class HomeView(TemplateView):
def get_context_data(self, *args, **kwargs):
context = super(HomeView, self).get_context_data(*args, **kwargs)
context.update(create_context(self.request))
context['nav_home'] = True
ipaddr = self.request.META['REMOTE_ADDR']
af = dns.inet.af_for_address(ipaddr)
key = 'ipv4' if af == dns.inet.AF_INET else 'ipv6'
self.request.session[key] = ipaddr
return context

0
nsupdate/manage.py Normal file → Executable file
View File

View File

@ -51,6 +51,8 @@
</div>
</div>
<div class="container content wrap">
<div class="row">
<div class="col-lg-12">
<div id="message_box">
{% if messages %}
{% for message in messages %}
@ -61,6 +63,8 @@
{% endfor %}
{% endif %}
</div>
</div>
</div>
{% block content %}
<div class="row" style="background-color: #DDDDDD">
<div class="col-sm-4" style="text-align: center">
@ -88,16 +92,16 @@
<hr>
<div class="row">
<div class="container">
{% if session.ipv4 and session.ipv6 %}
{% if request.session.ipv4 and request.session.ipv6 %}
<p>We think this are your IPs:</p>
{% elif session.ipv4 or session.ipv6 %}
{% elif request.session.ipv4 or request.session.ipv6 %}
<p>We think this is your IP:</p>
{% endif %}
{% if session.ipv4 %}
<h1>{{session.ipv4}}</h1>
{% elif session.ipv6 %}
<h1>{{session.ipv6}}</h1>
{% if request.session.ipv4 %}
<h1>{{request.session.ipv4}}</h1>
{% elif request.session.ipv6 %}
<h1>{{request.session.ipv4}}</h1>
{% else %}
<h1>HeyHo!</h1>
{% endif %}
@ -120,6 +124,11 @@
</div>
</div>
<div style="display: none">
<img src="//{{ WWW_IPV4_HOST }}/updateip" />
<img src="//{{ WWW_IPV6_HOST }}/updateip" />
</div>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
</body>
</html>