Create a new app, mercantile, which takes care of everything related to money and calculations. Add classes and variables to the models of both waffles and mercantile. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Your branch is up-to-date with 'origin/master'. # # Changes to be committed: # new file: mercantile/.models.py.swp # new file: mercantile/__init__.py # new file: mercantile/admin.py # new file: mercantile/migrations/__init__.py # new file: mercantile/models.py # new file: mercantile/tests.py # new file: mercantile/views.py # modified: waffles/models.py # # Changes not staged for commit: # modified: .gitignore #
49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
from django.contrib.auth.models import AbstractUser
|
|
from django.db import models
|
|
|
|
|
|
# Create your models here.
|
|
|
|
|
|
class UserProfile(AbstractUser):
|
|
pass
|
|
|
|
|
|
class Community(models.Model):
|
|
name = models.CharField(max_length=64)
|
|
members = models.ManyToManyField(UserProfile)
|
|
|
|
|
|
# Jeg har lyst til å vafle!
|
|
# Er det noen som er med?
|
|
class Listing(models.Model):
|
|
community = models.ForeignKey(Community)
|
|
timeFrom = models.DateTimeField()
|
|
timeTo = models.DateTimeField()
|
|
user = models.ForeignKey(UserProfile)
|
|
description = models.TextField()
|
|
|
|
|
|
class Event(models.Model):
|
|
name = models.CharField(max_length=64)
|
|
description = models.TextField()
|
|
status = models.BooleanField() # closed - no more edits
|
|
participants = models.ManyToManyField(UserProfile)
|
|
timeFrom = models.DateTimeField()
|
|
timeTo = models.DateTimeField()
|
|
|
|
|
|
class Subevent(models.Model):
|
|
name = models.CharField(max_length=64)
|
|
participants = models.ManyToManyField(UserProfile)
|
|
event = models.ForeignKey(Event)
|
|
|
|
|
|
class ShoppingList(models.Model):
|
|
name = models.CharField(max_length=64)
|
|
price = models.IntField
|
|
payers = models.ManyToManyField(UserProfile)
|
|
subevent = models.ForeignKey(Subevent)
|
|
|
|
|