From 7850b322c5e1aeb9d0cb41f3da746f8ed230794b Mon Sep 17 00:00:00 2001 From: seba Date: Thu, 6 Oct 2011 15:30:02 +0200 Subject: [PATCH] more documentation to come --- k4ever/buyable/models.py | 9 +++++++++ k4ever/docs/django/api.rst | 16 +++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/k4ever/buyable/models.py b/k4ever/buyable/models.py index 959c684..3916bc5 100644 --- a/k4ever/buyable/models.py +++ b/k4ever/buyable/models.py @@ -6,6 +6,7 @@ from decimal import Decimal # Create your models here. class BuyableType(models.Model): + """ Type/Category for a buyable object """ name = models.CharField(max_length=100) def __unicode__(self): @@ -13,6 +14,7 @@ class BuyableType(models.Model): class Buyable(models.Model): + """ Represents a buyable item. """ name = models.CharField(max_length=100) price = models.DecimalField(max_digits=8, decimal_places=2) image = models.ImageField(upload_to='img/buyable/') @@ -23,6 +25,7 @@ class Buyable(models.Model): def hasDeposit(self): + """ Returns True if the item has deposit. """ return self.deposit > Decimal(0) def createPurchase(self, isDeposit=False): @@ -44,6 +47,11 @@ class Buyable(models.Model): return item class Order(models.Model): + """ Represents an order by the user. + + + """ + An Order object is referenced by all :class:`Purchases ` user = models.ForeignKey(User) price = models.DecimalField(max_digits=8, decimal_places=2) dateTime = models.DateTimeField() @@ -85,6 +93,7 @@ class Order(models.Model): class Purchase(models.Model): + """ Represents a :class:``""" order = models.ForeignKey(Order) price = models.DecimalField(max_digits=8, decimal_places=2) isDeposit = models.BooleanField() diff --git a/k4ever/docs/django/api.rst b/k4ever/docs/django/api.rst index 72af8c0..66d06a9 100644 --- a/k4ever/docs/django/api.rst +++ b/k4ever/docs/django/api.rst @@ -4,15 +4,29 @@ API - how to access the read/write/put/create functions - what this api does and what not +K4ever has a REST-like API. This means every URL represents an object which has +four functions: `read`, `create`, `update` and `delete`. These functions are mapped +to the `HTTP`-Methods `GET`, `POST`, `PUT` and `DELETE`. Most of the functionality +uses only `GET` and `POST`, so everything is accessible via `wget`. + +The API enables you to list available items, buy them and transtact money to your +accout. It also has a *plugin*-concept. Plugins can be allowed by other user + + +Authentication can be done either per HTTP Basic Auth or for AJAX-Requests per +cookie. The + k4evers API -Authentication +Plugins -------------- - how does authentication work - what is the plugin authentication - when does a plugin need an user? - how to change user names + + URLs ---- For more information about a specific method you can click on the url/method to get