Commit e3913d8f authored by stef's avatar stef

[enh] initial commit - model 1st version

parents
from django.db import models
# Create your models here.
class Attachment(models.Model):
attachment = models.EmailField()
class Comment(models.Model):
submitter = models.EmailField()
comment = models.TextField()
comments = models.ForeignKey(Comment)
class Violation(models.Model):
COUNTRIES = (
# TODO complete and sort
('A', 'Austria'),
('B', 'Belgium'),
('CZ', 'Czech Republic'),
('HU', 'Hungary'),
('RO', 'Romania'),
('SE', 'Sweden'),
('PL', 'Poland'),
('ES', 'Spain'),
('PT', 'Portugal'),
('I', 'Italy'),
('DE', 'Germany'),
('SK', 'Slovakia'),
('FR', 'France'),
)
RESOURCES = (
('1', 'port'),
('2', 'protocol'),
('3', 'service'),
('4', 'site'),
('5', 'user'),
('6', 'ip'),
)
TYPES = (
('1', 'Blocking'),
('2', 'Throttling'),
)
MEDIA = (
('1', 'Fixed'),
('2', 'Mobile'),
)
country = models.CharField(max_length=2, choices=COUNTRIES)
operator = models.CharField()
contract = models.CharField()
comments = models.ForeignKey(Comment)
resource = models.CharField(max_length=1, choices=RESOURCES)
type = models.CharField(max_length=1, choices=RESOURCES)
media = models.CharField(max_length=1, choices=MEDIA)
temporary = models.BooleanField()
contractual = models.BooleanField()
contract = models.TextField()
loophole = models.BooleanField()
from django.template import Library, Variable
from django.conf import settings
from django import template
import random
register = Library()
@register.simple_tag
def root_url():
return settings.ROOT_URL
@register.simple_tag
def media_url():
return settings.MEDIA_URL
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)
# Create your views here.
#!/usr/bin/python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
sys.exit(1)
import settings
if __name__ == "__main__":
execute_manager(settings)
{% extends "base.html" %}
{% load i18n %}
{% block title %}Registration{% endblock %}
{% block content %}
{% trans "Your account activation might work now. If not mail me." %}
{% endblock content %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}Registration{% endblock %}
{% block content %}
{% trans "Your account is now active." %}
{% endblock content %}
{% load i18n %}
{% load tagger %}
{% trans "Here's your activation key" %}
{{activation_key}}
{% trans "Please click on this link to activate your account" %}
{%root_url%}{% url registration_activate activation_key %}
{% trans "This link will expire in:" %} {{expiration_days}} {% trans "days." %}
{% comment %}
{{site}}
{{site.name}}
{{site.domain}}
(by default name == domain)
{% endcomment %}
{%load tagger%}{%root_url%} account registration
{% extends "base.html" %}
{% load i18n %}
{% block title %}Login{% endblock %}
{% block content %}
<form action="{% url django.contrib.auth.views.login %}" method="post">{% csrf_token %}
{{form.as_p}}
<input type="hidden" name="next" value="{{next}}" />
<input type="submit" name="login" value="Login" />
</form>
<p>[<a href="{% url django.contrib.auth.views.password_reset %}">{% trans "Password reset" %}</a>]</p>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans 'Password change successful' %}{% endblock %}
{% block content %}
<p>{% trans 'Your password was changed.' %}</p>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans 'Password change' %}{% endblock %}
{% block content %}
<form action="" method="post">{% csrf_token %}
<div>
{% if form.errors %}
<p class="errornote">
{% blocktrans count form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</p>
{% endif %}
<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
<fieldset class="module aligned wide">
<div class="form-row">
{{ form.old_password.errors }}
<label for="id_old_password" class="required">{% trans 'Old password' %}:</label>{{ form.old_password }}
</div>
<div class="form-row">
{{ form.new_password1.errors }}
<label for="id_new_password1" class="required">{% trans 'New password' %}:</label>{{ form.new_password1 }}
</div>
<div class="form-row">
{{ form.new_password2.errors }}
<label for="id_new_password2" class="required">{% trans 'Password (again)' %}:</label>{{ form.new_password2 }}
</div>
</fieldset>
<div class="submit-row">
<input type="submit" value="{% trans 'Change my password' %}" class="default" />
</div>
<script type="text/javascript">document.getElementById("id_old_password").focus();</script>
</div>
</form>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans 'Password reset complete' %}{% endblock %}
{% block content %}
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<p><a href="{{ login_url }}">{% trans 'Log in' %}</a></p>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans 'Password reset' %}{% endblock %}
{% block content %}
{% if validlink %}
<h2>{% trans 'Enter new password' %}</h2>
<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
<form action="" method="post">{% csrf_token %}
{{ form.new_password1.errors }}
<p class="aligned wide"><label for="id_new_password1">{% trans 'New password:' %}</label>{{ form.new_password1 }}</p>
{{ form.new_password2.errors }}
<p class="aligned wide"><label for="id_new_password2">{% trans 'Confirm password:' %}</label>{{ form.new_password2 }}</p>
<p><input type="submit" value="{% trans 'Change my password' %}" /></p>
</form>
{% else %}
<h2>{% trans 'Password reset unsuccessful' %}</h2>
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
{% endif %}
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans 'Password reset successful' %}{% endblock %}
{% block content %}
<p>{% trans "We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly." %}</p>
{% endblock %}
{% load i18n %}{% autoescape off %}
{% trans "You're receiving this e-mail because you requested a password reset" %}
{% blocktrans %}for your user account at {{ site_name }}{% endblocktrans %}.
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url django.contrib.auth.views.password_reset_confirm uidb36=uid token=token %}
{% endblock %}
{% trans "Your username, in case you've forgotten:" %} {{ user.username }}
{% trans "Thanks for using our site!" %}
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
{% endautoescape %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Password reset" %}{% endblock %}
{% block content %}
<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one." %}</p>
<form action="" method="post">{% csrf_token %}
{{ form.email.errors }}
<p><label for="id_email">{% trans 'E-mail address:' %}</label> {{ form.email }} <input type="submit" value="{% trans 'Reset my password' %}" /></p>
</form>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}Registration{% endblock %}
{% block content %}
{% trans "An email containing account-activation information has been sent." %}
{% endblock content %}
{% extends "base.html" %}
{% block title %}Registration{% endblock %}
{% block content %}
<form action="" method="post">{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<input type="submit" />
</form>
{% endblock content %}
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
from bt import views as bt
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
(r'^accounts/logout$', 'django.contrib.auth.views.logout', {'next_page' : '/'}),
(r'^accounts/', include('registration.urls')),
(r'^u/(?P<user>.+)/(?P<tags>.+)?$', bt.edit),
# Uncomment the next line to enable the admin:
#(r'^admin/', include(admin.site.urls)),
)
if settings.DEV_SERVER:
urlpatterns += patterns('',
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_PATH}),
)
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