Browse Source

OLD API: Removed deprecated api

Sebastian Lohff 9 years ago
parent
commit
44c1d2c714
6 changed files with 0 additions and 104 deletions
  1. 0
    0
      k4ever/api/__init__.py
  2. 0
    3
      k4ever/api/models.py
  3. 0
    23
      k4ever/api/tests.py
  4. 0
    9
      k4ever/api/urls.py
  5. 0
    68
      k4ever/api/views.py
  6. 0
    1
      k4ever/urls.py

+ 0
- 0
k4ever/api/__init__.py View File


+ 0
- 3
k4ever/api/models.py View File

@@ -1,3 +0,0 @@
1
-from django.db import models
2
-
3
-# Create your models here.

+ 0
- 23
k4ever/api/tests.py View File

@@ -1,23 +0,0 @@
1
-"""
2
-This file demonstrates two different styles of tests (one doctest and one
3
-unittest). These will both pass when you run "manage.py test".
4
-
5
-Replace these with more appropriate tests for your application.
6
-"""
7
-
8
-from django.test import TestCase
9
-
10
-class SimpleTest(TestCase):
11
-    def test_basic_addition(self):
12
-        """
13
-        Tests that 1 + 1 always equals 2.
14
-        """
15
-        self.failUnlessEqual(1 + 1, 2)
16
-
17
-__test__ = {"doctest": """
18
-Another way to test that 1 + 1 is equal to 2.
19
-
20
->>> 1 + 1 == 2
21
-True
22
-"""}
23
-

+ 0
- 9
k4ever/api/urls.py View File

@@ -1,9 +0,0 @@
1
-from django.conf.urls.defaults import *
2
-
3
-#/api/
4
-urlpatterns = patterns('',
5
-	(r'^store/$', 'api.views.showItems'),
6
-	(r'^store/show/(\d+)/$', 'api.views.showItem'),
7
-	(r'^store/buy/(\d+)/(|with/deposit|only/deposit)/?$', 'api.views.buyItem'),
8
-	(r'^store/history/?$', 'api.views.history'),
9
-)

+ 0
- 68
k4ever/api/views.py View File

@@ -1,68 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-from django.contrib.auth.decorators import login_required
3
-from django.http import HttpResponse
4
-
5
-import datetime
6
-from buyable.models import Buyable, Purchase, Order
7
-from django.core import serializers
8
-
9
-
10
-@login_required
11
-def showItems(request):
12
-	# FIXME: Implement pagination here
13
-	items = Buyable.objects.all()
14
-	
15
-	#return json-container
16
-	container = serializers.serialize('json', items)
17
-	return HttpResponse(container,'application/json')
18
-
19
-@login_required
20
-def showItem(request, itemid):
21
-	try:
22
-		item = Buyable.objects.get(id=itemid)
23
-	except Buyable.DoesNotExist:
24
-		# baww, kein item mit der id :( (oder mutax trollt rum)
25
-		return HttpResponse(status=400)
26
-		
27
-	#return json-container
28
-	container = serializers.serialize('json', [item])
29
-	return HttpResponse(container,'application/json')
30
-
31
-
32
-@login_required
33
-def buyItem(request, itemid, buymode=""):
34
-	user = request.user
35
-	try:
36
-		item = Buyable.objects.get(id=itemid)
37
-	except Buyable.DoesNotExist:
38
-		# oh no! kein item mit der id :( mutax trollt rum)
39
-		return HttpResponseRedirect("/store/buy/")
40
-	""" tristate variable buymode:
41
-			""              only item
42
-			"with/deposit"  item and deposit
43
-			"only/deposit"  only deposit
44
-	"""
45
-	order = Order(user=request.user)
46
-	order.save() # for the id!
47
-	if buymode == "" or buymode == "with/deposit":
48
-		p = Purchase(order=order, buyable=item, isDeposit=False)
49
-		p.save(saveOrder=False)
50
-	# TANNEK! if buymode == "with/dopsit" or buymode == "only/deposit":
51
-	if buymode == "with/deposit" or buymode == "only/deposit":
52
-		p = Purchase(order=order, buyable=item, isDeposit=True)
53
-		p.save(saveOrder=False)
54
-	order.save()
55
-	
56
-	#return json-container
57
-	#container = serializers.serialize('json', items)
58
-	#return HttpResponse(container,'application/json')
59
-	return HttpResponse(status=200)
60
-	#return HttpResponseRedirect("/store/bought/%s/" % (order.id)) 
61
-
62
-@login_required
63
-def history(request):
64
-	hist = Order.objects.filter(user=request.user.id).order_by("-dateTime")
65
-	#return json-container
66
-	container = serializers.serialize('json', [hist])
67
-	return HttpResponse(container,'application/json')
68
-

+ 0
- 1
k4ever/urls.py View File

@@ -18,7 +18,6 @@ urlpatterns = patterns('',
18 18
 	# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
19 19
 	# user stuff? go to main
20 20
 	(r'^$', 'main.views.startpage'),
21
-	(r'^api/', include('api.urls')),
22 21
 	(r'^api2/', include('api2.urls')),
23 22
 	(r'^user/', include('main.urls')),
24 23
 	(r'^transaction/', include('transaction.urls')),

Loading…
Cancel
Save