whuppie, works (mostly), minor api probs

This commit is contained in:
seba 2011-09-30 22:55:31 +02:00
parent d6a3b21d51
commit 97ea6a6d31
8 changed files with 53 additions and 17 deletions

View File

@ -1,18 +1,18 @@
WTFs: WTFs:
[x] Kontostand beim kaufen auch veraendern.. [x] Kontostand beim kaufen auch veraendern..
[x] Einkaufshistory basteln [x] Einkaufshistory basteln
[ ] Beim einkaufen von Objekten ohne Deposit sollten es nicht moeglich sein diese "with Deposit" zu kaufen [x] Beim einkaufen von Objekten ohne Deposit sollten es nicht moeglich sein diese "with Deposit" zu kaufen
Noch zu tun: Noch zu tun:
[ ] "Home" mit inhalt fuellen [x] "Home" mit inhalt fuellen
[ ] API [x] API
[ ] Kassenwart-ueberweisung "ok" interface [ ] Kassenwart-ueberweisung "ok" interface
[ ] Einstellungen (email bei ueberweisung,...?) [ ] Einstellungen (email bei ueberweisung,...?)
[ ] Ldap anbindung fuer login [x] Ldap anbindung fuer login
Nice-to-haf: Nice-to-haf:
[ ] Search'n'Buy [x] Search'n'Buy
[ ] API-Beispiele [ ] API-Beispiele
Konrad: Konrad:

View File

@ -73,6 +73,11 @@ auth/
blob blob to get user from / auth user with, returns User or NULL blob blob to get user from / auth user with, returns User or NULL
POST POST
""" set authblob if allowed """ """ set authblob if allowed """
user/
GET (=get)
""" get user by authblob string - this function works only when plugin
has unique authblobs """
authblob [REQ] authblob to sear
config/ config/
GET (=get) GET (=get)

View File

@ -21,7 +21,7 @@ class Buyable(models.Model):
buyableType = models.ManyToManyField(BuyableType) buyableType = models.ManyToManyField(BuyableType)
def hasDeposit(self): def hasDeposit(self):
return self.deposit > 0.0 return self.deposit > Decimal(0)
def createPurchase(self, isDeposit=False): def createPurchase(self, isDeposit=False):
p = Purchase() p = Purchase()

View File

@ -2,12 +2,27 @@
{% block "content" %} {% block "content" %}
{% if item %} {% if item %}
You got the item {{ item }}. <table border="1" frame="box" rules="cols" width="40%" cellpadding="5">
Buy <a href="/store/buy/{{ item.id }}/">it!</a> <tr>
{% if item.hasDeposit %} <td colspan="2"><img src="{{ MEDIA_URL }}{{ item.image }}"></td>
</tr>
<tr>
<th>Zugeh&ouml;rig zu:</th>
<td>{% for type in item.buyableType.all %}
{{ type }}
{% endfor %}</td>
</tr>
<tr>
<th>Kauf {{ item }}:</th>
<td>Buy <a href="/store/buy/{{ item.id }}/">it!</a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>{% if item.hasDeposit %}
<a href="/store/buy/{{ item.id }}/with/deposit/">it+deposit!</a> <a href="/store/buy/{{ item.id }}/with/deposit/">it+deposit!</a>
<a href="/store/buy/{{ item.id }}/only/deposit/"> only deposit!</a> <a href="/store/buy/{{ item.id }}/only/deposit/"> only deposit!</a>
{% endif %} {% endif %}</td>
</tr></table>
{% else %} {% else %}
No item found :( No item found :(
{% endif %} {% endif %}

View File

@ -2,7 +2,18 @@
{% block "content" %} {% block "content" %}
{% for item in items %} {% for item in items %}
<img src="{{ MEDIA_URL }}{{ item.image }}">{{ item }} <div style="float:left; width=200; ">
<a href="/store/show/{{ item.id }}">{{ item.name }}</a> <a href="/store/show/{{ item.id }}"><img WIDTH=64 HEIGHT=64 src="{{ MEDIA_URL }}{{ item.image }}"></a>
</br> {{ item }}
</br> Buy <a href="/store/buy/{{ item.id }}/">it!</a>
{% if item.hasDeposit %}
<a href="/store/buy/{{ item.id }}/with/deposit/">it+deposit!</a>
<a href="/store/buy/{{ item.id }}/only/deposit/"> only deposit!</a>
{% endif %}
</br> (
{% for type in item.buyableType.all %}
{{ type }}
{% endfor %} )
</div>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}

View File

@ -3,8 +3,7 @@
{% block "content" %} {% block "content" %}
<h2>Passwort</h2> <h2>Passwort</h2>
<hr /> <hr />
&lt;Change Password here&gt; Da die meisten der Nutzer dieses Systems &uuml;ber den LDAP der Freitagsrunde laufen, kann man hier sein Passwort nicht &auml;ndern. Wenn du dein Passwort trotzdem &auml;ndern m&ouml;chstest (und dieses System nicht &uuml;ber einen Freitagsrundenaccount benutzt), wende dich bitte an einen der Freitagsrunden-Admins. (lies: not implemented)
<br />
<br /> <br />
<br /> <br />
<h2>Plugin Berechtigungen</h2> <h2>Plugin Berechtigungen</h2>

View File

@ -16,7 +16,7 @@ def startpage(request):
allMost = Purchase.objects.filter(isDeposit=False).values('buyable__name', 'buyable__id').annotate(num_buys=Count('buyable')).order_by('-num_buys') allMost = Purchase.objects.filter(isDeposit=False).values('buyable__name', 'buyable__id').annotate(num_buys=Count('buyable')).order_by('-num_buys')
usersMost = Purchase.objects.filter(isDeposit=False).values('buyable__name','buyable__id').filter(order__user=request.user.id).annotate(num_buys=Count('buyable')).order_by('-num_buys') usersMost = Purchase.objects.filter(isDeposit=False).values('buyable__name','buyable__id').filter(order__user=request.user.id).annotate(num_buys=Count('buyable')).order_by('-num_buys')
usersLast = Purchase.objects.filter(isDeposit=False).values('buyable__name','buyable__id').filter(order__user=request.user.id).order_by('-order__dateTime') usersLast = Purchase.objects.filter(isDeposit=False).values('buyable__name','buyable__id').filter(order__user=request.user.id).order_by('-order__dateTime')
return render_to_response("main/startpage.html", {'allMost' : allMost,'usersMost': usersMost, 'usersLast' : usersLast}, RequestContext(request)) return render_to_response("main/startpage.html", {'allMost' : allMost,'usersMost': usersMost, 'usersLast' : usersLast[:12]}, RequestContext(request))
def register(request): def register(request):
return render_to_response("registration/register.html", RequestContext(request)) return render_to_response("registration/register.html", RequestContext(request))
@ -88,6 +88,11 @@ def pluginAuthblob(request, pluginId):
d['pluginerror'] = "Der Authblob darf f&uuml;r dieses Plugin nicht vom User ver&auml;ndert werden (oder der Authblob war kaputt)" d['pluginerror'] = "Der Authblob darf f&uuml;r dieses Plugin nicht vom User ver&auml;ndert werden (oder der Authblob war kaputt)"
return render_to_response("settings/settings.html", d, RequestContext(request)) return render_to_response("settings/settings.html", d, RequestContext(request))
if p.plugin.uniqueAuthblob and PluginPermission.objects.filter(plugin=plugin, authblob=request.POST["authblob"]).count() > 0:
d = getPluginDict(request)
d['pluginerror'] = "Achtung! Dein Authblob wird bereits von einer anderen Person benutzt. Bitte w&auml;hle einen anderen (eindeutigen) Authblob!"
return render_to_response("settings/settings.html", d, RequestContext(request))
p.authblob = request.POST['authblob'] p.authblob = request.POST['authblob']
p.save() p.save()
d = getPluginDict(request) d = getPluginDict(request)

View File

@ -3,6 +3,7 @@ from models import Transaction, TransactionType
from django.contrib import admin from django.contrib import admin
class TransactionAdmin(admin.ModelAdmin): class TransactionAdmin(admin.ModelAdmin):
list_filter = ('checked','transactionType','amount')
actions = ['really_delete_selected'] actions = ['really_delete_selected']
def get_actions(self, request): def get_actions(self, request):