From ee7a93858a076711e22f0b2334404c748e404b52 Mon Sep 17 00:00:00 2001 From: seba Date: Wed, 13 Oct 2010 06:59:30 +0200 Subject: [PATCH] Alles kaputt, zeigt transactionhistory an --- k4ever/k4ever.db | Bin 57344 -> 58368 bytes k4ever/main/models.py | 3 ++ k4ever/main/templates/base.html | 27 ++++++++++++++++ .../main/templates/main/navigation-login.html | 8 +++++ k4ever/main/templates/main/navigation.html | 2 ++ k4ever/main/templates/main/startpage.html | 5 +++ k4ever/main/templates/registration/login.html | 30 ++++++++++++++++++ .../main/templates/registration/logout.html | 5 +++ .../main/templates/registration/register.html | 19 +++++++++++ k4ever/main/templates/templ.html | 5 +++ k4ever/main/urls.py | 10 ++++++ k4ever/main/views.py | 11 ++++++- k4ever/settings.py | 4 ++- k4ever/transaction/models.py | 6 ++-- .../templates/transaction/overview.html | 14 ++++++++ k4ever/transaction/urls.py | 8 +++++ k4ever/transaction/views.py | 21 +++++++++++- k4ever/urls.py | 23 ++++++++------ 18 files changed, 186 insertions(+), 15 deletions(-) create mode 100644 k4ever/main/templates/base.html create mode 100644 k4ever/main/templates/main/navigation-login.html create mode 100644 k4ever/main/templates/main/navigation.html create mode 100644 k4ever/main/templates/main/startpage.html create mode 100644 k4ever/main/templates/registration/login.html create mode 100644 k4ever/main/templates/registration/logout.html create mode 100644 k4ever/main/templates/registration/register.html create mode 100644 k4ever/main/templates/templ.html create mode 100644 k4ever/main/urls.py create mode 100644 k4ever/transaction/templates/transaction/overview.html create mode 100644 k4ever/transaction/urls.py diff --git a/k4ever/k4ever.db b/k4ever/k4ever.db index 052897fc288ea26c0f00d0aae10b33b5d19d10b0..e8eefa0b8089de70cdeb4e94072b60c797daab4b 100644 GIT binary patch delta 1567 zcmah|TTB#J7@mL5!oq^78*HIm2V{}eWu5B|v&74)3xyR7sIY8eT6T7Zi+}_~#5BRt zXwsTg;D6|gO`9~WX@byY6VpDmO%o$)`cjkDrZqKcqD|VGrrHNhwP%Nr5;5(`%%7a| zedqgc=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n38h{|3%b?!o{7 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 @@ + + + + + Cashboxes are forever... + + +
+ Its Alive - and here could be a logo. Wouldn't that be nice? + {% if user.is_authenticated %} + Logged in as {{ user }} + {% endif %} +
+ +
+ {% block "content" %}{% endblock %} +
+ + diff --git a/k4ever/main/templates/main/navigation-login.html b/k4ever/main/templates/main/navigation-login.html new file mode 100644 index 0000000..f1b53f9 --- /dev/null +++ b/k4ever/main/templates/main/navigation-login.html @@ -0,0 +1,8 @@ +Main
+Buy
+Konto
+History
+{% if user.is_staff %} +
Admin foo
+Admin Interface

{% endif %} +Logout

diff --git a/k4ever/main/templates/main/navigation.html b/k4ever/main/templates/main/navigation.html new file mode 100644 index 0000000..00a7370 --- /dev/null +++ b/k4ever/main/templates/main/navigation.html @@ -0,0 +1,2 @@ +Login

+Registrieren

diff --git a/k4ever/main/templates/main/startpage.html b/k4ever/main/templates/main/startpage.html new file mode 100644 index 0000000..c2888ce --- /dev/null +++ b/k4ever/main/templates/main/startpage.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} + +{% block "content" %} + No content here. +{% endblock %} diff --git a/k4ever/main/templates/registration/login.html b/k4ever/main/templates/registration/login.html new file mode 100644 index 0000000..f8df213 --- /dev/null +++ b/k4ever/main/templates/registration/login.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} + +{% block "content" %} +{% if form.errors %} + + +

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.

+{% endif %} + +
+{% csrf_token %} + + + + + + + + + +
{{ form.username.label_tag }}{{ form.username }}
{{ form.password.label_tag }}{{ form.password }}
+ + + +
+ +{% endblock %} diff --git a/k4ever/main/templates/registration/logout.html b/k4ever/main/templates/registration/logout.html new file mode 100644 index 0000000..418f7ce --- /dev/null +++ b/k4ever/main/templates/registration/logout.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} + +{% block "content" %} +FIXME: KKTHXBYE +{% endblock %} diff --git a/k4ever/main/templates/registration/register.html b/k4ever/main/templates/registration/register.html new file mode 100644 index 0000000..9b21223 --- /dev/null +++ b/k4ever/main/templates/registration/register.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} + +{% block "content" %} +
+>>> 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 %} +
+ {% endfor %} +{% endblock %} diff --git a/k4ever/transaction/urls.py b/k4ever/transaction/urls.py new file mode 100644 index 0000000..60c9fc1 --- /dev/null +++ b/k4ever/transaction/urls.py @@ -0,0 +1,8 @@ +from django.conf.urls.defaults import * + + +urlpatterns = patterns('', + (r'^$', 'transaction.views.overview'), + #(r'^transfer/$', 'transaction.views.transfer'), + #(r'^checkTransfers/$', 'transaction.views.checkTransfers'), +) diff --git a/k4ever/transaction/views.py b/k4ever/transaction/views.py index 60f00ef..8d7115e 100644 --- a/k4ever/transaction/views.py +++ b/k4ever/transaction/views.py @@ -1 +1,20 @@ -# Create your views here. +from django.shortcuts import render_to_response +from django.template import RequestContext +from django.contrib.auth.decorators import login_required +from models import Transaction, TransactionType + +@login_required +def overview(request): + history = Transaction.objects.filter(user=request.user).order_by("dateTime") + return render_to_response("transaction/overview.html", {'history': history}, RequestContext(request)) + +#@login_required +#def transfer(request): +# if request.method == 'POST': +# +# return render_to_response("transaction/transfered.html", RequestContext(request)) + +#@kassenwart_required +#def checkTransfers(request): +# transfers = Transaction.objects.filter(checked=False).sort("dateTime") +# return render_to_response("transaction/uncheckedTransfers.html", {'transfers' : tranfers}, RequestContext(request)) \ No newline at end of file diff --git a/k4ever/urls.py b/k4ever/urls.py index 284af01..434639b 100644 --- a/k4ever/urls.py +++ b/k4ever/urls.py @@ -5,13 +5,18 @@ from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', - # Example: - # (r'^k4ever/', include('k4ever.foo.urls')), - - # Uncomment the admin/doc line below and add 'django.contrib.admindocs' - # to INSTALLED_APPS to enable admin documentation: - # (r'^admin/doc/', include('django.contrib.admindocs.urls')), - - # Uncomment the next line to enable the admin: - (r'^admin/', include(admin.site.urls)), + # Example: + # (r'^k4ever/', include('k4ever.foo.urls')), + + # Uncomment the admin/doc line below and add 'django.contrib.admindocs' + # to INSTALLED_APPS to enable admin documentation: + # (r'^admin/doc/', include('django.contrib.admindocs.urls')), + # user stuff? go to main + (r'^$', 'main.views.startpage'), + (r'^user/', include('main.urls')), + (r'^transaction/', include('transaction.urls')), + #(r'^buy/', include('buyable.urls')), + + # Uncomment the next line to enable the admin: + (r'^admin/', include(admin.site.urls)), )