diff --git a/k4ever/k4ever.db b/k4ever/k4ever.db index 052897f..e8eefa0 100644 Binary files a/k4ever/k4ever.db and b/k4ever/k4ever.db differ diff --git a/k4ever/main/models.py b/k4ever/main/models.py index 83ccfef..f9fd3c9 100644 --- a/k4ever/main/models.py +++ b/k4ever/main/models.py @@ -4,3 +4,6 @@ from django.contrib.auth.models import User class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) balance = models.FloatField() + + def __unicode__(self): + return "%s (Kontostand: %s)" % (self.user ,self.balance) \ No newline at end of file diff --git a/k4ever/main/templates/base.html b/k4ever/main/templates/base.html new file mode 100644 index 0000000..a1b5df5 --- /dev/null +++ b/k4ever/main/templates/base.html @@ -0,0 +1,27 @@ + + +
+ +Dein Benutzername oder Passwort oder beides ist falsch.
+ Versuch es nochmal, aber achte auf CAPSLOCK und tippe nicht so schnell..
Falls du dein Passwort vergessen haben solltest (oder es nicht geht..), dann
+melde dich bei einem Admin deiner Wahl.
+>>> from frunde import tannek +>>> tannek.troll(subject="registration_not_avaliable", extended_mode=True) +ERROR_WHILE_HANDLING_EXCEPTION +Matestand: -65337 +>>> tannek.insertMate() +Matestand: -65336 +>>> [tannek.insertMate() for i in range(65337)] +STACK_SIZE_EXCEEDED +>>> [tannek.insertMate() for i in range(tannek.STACK_SIZE)] # FUCK YA! +UNKNOWN_COMMAND +>>> tannek.fixEverything() +rebooting ... ++You see? No registration right now! I tried and tried and it didn't work. +{% endblock %} \ No newline at end of file diff --git a/k4ever/main/templates/templ.html b/k4ever/main/templates/templ.html new file mode 100644 index 0000000..c2888ce --- /dev/null +++ b/k4ever/main/templates/templ.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} + +{% block "content" %} + No content here. +{% endblock %} diff --git a/k4ever/main/urls.py b/k4ever/main/urls.py new file mode 100644 index 0000000..9f1e042 --- /dev/null +++ b/k4ever/main/urls.py @@ -0,0 +1,10 @@ +from django.conf.urls.defaults import * +from django.conf import settings + + +urlpatterns = patterns('', + (r'^$', 'django.views.generic.simple.redirect_to', {'url': 'login/'}), + (r'^register/$', 'main.views.register'), + (r'^login/$', 'django.contrib.auth.views.login'), + (r'^logout/$', 'django.contrib.auth.views.logout', {'template_name': 'registration/logout.html'}), +) diff --git a/k4ever/main/views.py b/k4ever/main/views.py index 60f00ef..35ba0ec 100644 --- a/k4ever/main/views.py +++ b/k4ever/main/views.py @@ -1 +1,10 @@ -# Create your views here. +from django.shortcuts import render_to_response +from django.template import RequestContext +from django.contrib.auth.decorators import login_required + +@login_required +def startpage(request): + return render_to_response("main/startpage.html", {}, RequestContext(request)) + +def register(request): + return render_to_response("registration/register.html", RequestContext(request)) diff --git a/k4ever/settings.py b/k4ever/settings.py index 065b14f..945b41a 100644 --- a/k4ever/settings.py +++ b/k4ever/settings.py @@ -60,8 +60,10 @@ ADMIN_MEDIA_PREFIX = '/media/admin/' # Make this unique, and don't share it with anybody. SECRET_KEY = 'l(f*a$l)_n_n_5#lh@rvhv(na^!lj1u#bow=c!*90(1w$5%b^j' -# User Profile +# User Profile / Login stuff AUTH_PROFILE_MODULE = 'main.models.UserProfile' +LOGIN_URL = '/user/login/' +LOGIN_REDIRECT_URL = '/' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( diff --git a/k4ever/transaction/models.py b/k4ever/transaction/models.py index 23c5874..23ee89d 100644 --- a/k4ever/transaction/models.py +++ b/k4ever/transaction/models.py @@ -7,17 +7,17 @@ class TransactionType(models.Model): needsCheck = models.BooleanField(default=True) def __unicode__(self): - return self.name + (self.needsCheck and " (needs Check)" or "") + return unicode(self.name + (self.needsCheck and " (needs Check)" or "")) class Transaction(models.Model): - user = models.ForeignKey(User, unique=True) + user = models.ForeignKey(User) transactionType = models.ForeignKey(TransactionType) dateTime = models.DateTimeField() amount = models.FloatField() checked = models.BooleanField(default=False) def __unicode__(self): - return "%s for user %s (%s), %schecked" % (self.amount, self.user, self.transactionType, (self.checked and "" or "not ")) + return u"%s for user %s (%s), %schecked" % (self.amount, self.user, self.transactionType, (self.checked and "" or "not ")) diff --git a/k4ever/transaction/templates/transaction/overview.html b/k4ever/transaction/templates/transaction/overview.html new file mode 100644 index 0000000..2f07ffe --- /dev/null +++ b/k4ever/transaction/templates/transaction/overview.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} + +{% block "content" %} + + {% for transaction in history %} + {{ transaction.amount }}, got that by {{ transaction.type }} + {% if transaction.checked %} + ist eingegangen + {% else %} + noch nicht da + {% endif %} +