made home template and added admin link to nav
This commit is contained in:
parent
6a8707e2c6
commit
d44c8a7e90
@ -1,8 +1,28 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.forms import ModelForm
|
from django.forms import ModelForm
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
class BlacklistedDomain(models.Model):
|
||||||
|
domain = models.CharField(max_length=256, unique=True, help_text='Blacklisted domain. Evaluated as regex (search).')
|
||||||
|
|
||||||
|
last_update = models.DateTimeField(auto_now=True)
|
||||||
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
|
created_by = models.ForeignKey(User)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return u"%s" % (self.domain)
|
||||||
|
|
||||||
|
|
||||||
|
def domain_blacklist_validator(value):
|
||||||
|
for bd in BlacklistedDomain.objects.all():
|
||||||
|
if re.search(bd.domain, value):
|
||||||
|
raise ValidationError(u'This domain is not allowed')
|
||||||
|
|
||||||
|
|
||||||
class Domain(models.Model):
|
class Domain(models.Model):
|
||||||
domain = models.CharField(max_length=256, unique=True)
|
domain = models.CharField(max_length=256, unique=True)
|
||||||
|
46
nsupdate/main/templates/main/home.html
Normal file
46
nsupdate/main/templates/main/home.html
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load bootstrap %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row" style="background-color: #DDDDDD">
|
||||||
|
<div class="col-sm-4" style="text-align: center">
|
||||||
|
<h1><i class="icon-globe icon-4x"></i></h1>
|
||||||
|
<h3>World Wide Web</h3>
|
||||||
|
<p>
|
||||||
|
nsupdate.info is a free and <a href="https://github.com/asmaps/nsupdate.info">open-source</a> dynamic DNS service with IPv4 and IPv6 support.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4" style="text-align: center">
|
||||||
|
<h1><i class="icon-cogs icon-4x"></i></h1>
|
||||||
|
<h3>Awesomeness</h3>
|
||||||
|
<p>
|
||||||
|
Powered by python, the magical django pony and a stupid three columned icon landing page.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4" style="text-align: center">
|
||||||
|
<h1><i class="icon-trophy icon-4x"></i></h1>
|
||||||
|
<h3>The Throphy Is A Lie</h3>
|
||||||
|
<p>
|
||||||
|
nsupdate.info is winner of the <a href="http://djangodash.com">Django-Dash</a> 2013 with the highest score in the history of the competition.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
<div class="container">
|
||||||
|
{% if request.session.ipv4 and request.session.ipv6 %}
|
||||||
|
<p>We think this are your IPs:</p>
|
||||||
|
{% elif request.session.ipv4 or request.session.ipv6 %}
|
||||||
|
<p>We think this is your IP:</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if request.session.ipv4 %}
|
||||||
|
<h1>{{request.session.ipv4}}</h1>
|
||||||
|
{% elif request.session.ipv6 %}
|
||||||
|
<h1>{{request.session.ipv4}}</h1>
|
||||||
|
{% else %}
|
||||||
|
<h1>HeyHo!</h1>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@ -17,7 +17,7 @@ from main.models import Host
|
|||||||
|
|
||||||
|
|
||||||
class HomeView(TemplateView):
|
class HomeView(TemplateView):
|
||||||
template_name = "base.html"
|
template_name = "main/home.html"
|
||||||
|
|
||||||
def get_context_data(self, *args, **kwargs):
|
def get_context_data(self, *args, **kwargs):
|
||||||
context = super(HomeView, self).get_context_data(*args, **kwargs)
|
context = super(HomeView, self).get_context_data(*args, **kwargs)
|
||||||
|
@ -41,6 +41,9 @@
|
|||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="{% url 'account_profile' %}">Profile</a></li>
|
<li><a href="{% url 'account_profile' %}">Profile</a></li>
|
||||||
<li><a href="{% url 'password_change' %}">Change password</a></li>
|
<li><a href="{% url 'password_change' %}">Change password</a></li>
|
||||||
|
{% if request.user.is_staff %}
|
||||||
|
<li><a href="/admin/">Admin</a></li>
|
||||||
|
{% endif %}
|
||||||
<li><a href="{% url 'auth_logout' %}">Logout</a></li>
|
<li><a href="{% url 'auth_logout' %}">Logout</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@ -65,48 +68,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row" style="background-color: #DDDDDD">
|
Here goes the content.
|
||||||
<div class="col-sm-4" style="text-align: center">
|
|
||||||
<h1><i class="icon-globe icon-4x"></i></h1>
|
|
||||||
<h3>World Wide Web</h3>
|
|
||||||
<p>
|
|
||||||
nsupdate.info is a free and <a href="https://github.com/asmaps/nsupdate.info">open-source</a> dynamic DNS service with IPv4 and IPv6 support.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4" style="text-align: center">
|
|
||||||
<h1><i class="icon-cogs icon-4x"></i></h1>
|
|
||||||
<h3>Awesomeness</h3>
|
|
||||||
<p>
|
|
||||||
Powered by python, the magical django pony and a stupid three columned icon landing page.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4" style="text-align: center">
|
|
||||||
<h1><i class="icon-trophy icon-4x"></i></h1>
|
|
||||||
<h3>The Throphy Is A Lie</h3>
|
|
||||||
<p>
|
|
||||||
nsupdate.info is winner of the <a href="http://djangodash.com">Django-Dash</a> 2013 with the highest score in the history of the competition.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="row">
|
|
||||||
<div class="container">
|
|
||||||
{% if request.session.ipv4 and request.session.ipv6 %}
|
|
||||||
<p>We think this are your IPs:</p>
|
|
||||||
{% elif request.session.ipv4 or request.session.ipv6 %}
|
|
||||||
<p>We think this is your IP:</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if request.session.ipv4 %}
|
|
||||||
<h1>{{request.session.ipv4}}</h1>
|
|
||||||
{% elif request.session.ipv6 %}
|
|
||||||
<h1>{{request.session.ipv4}}</h1>
|
|
||||||
{% else %}
|
|
||||||
<h1>HeyHo!</h1>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user