more documentation to come
This commit is contained in:
parent
6ee2e91338
commit
7850b322c5
|
@ -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 <Purchase>`
|
||||
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()
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue