parent
4781fbe816
commit
3ec3ddbbe8
@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
@ -0,0 +1,5 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class WishlistConfig(AppConfig):
|
||||||
|
name = 'wishlist'
|
@ -0,0 +1,46 @@
|
|||||||
|
# Generated by Django 3.1.6 on 2021-02-14 07:28
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='WishList',
|
||||||
|
fields=[
|
||||||
|
('slug', models.SlugField(editable=False, help_text="URL suffix for this wishlist. Must not clash existing ones, nor be 'user' nor 'item'.", primary_key=True, serialize=False)),
|
||||||
|
('name', models.TextField(help_text='The title of the wishlist.')),
|
||||||
|
('description', models.TextField(blank=True, help_text='Optional (public) description of the wishlist.')),
|
||||||
|
('hidden', models.BooleanField(default=True, help_text="Whether to hide on the users' list of their wishlists.")),
|
||||||
|
('hide_granted', models.BooleanField(default=False, help_text='Whether to hide already fulfilled wishes.')),
|
||||||
|
('owner', models.ForeignKey(help_text='The user owning this wishlist.', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='WishedItem',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
('name', models.TextField(help_text='Name of the wished item.')),
|
||||||
|
('description', models.TextField(help_text='Detailed description of the item, for example its specification.')),
|
||||||
|
('wishlists', models.ManyToManyField(help_text='Wishlists that this wish should be part of.', related_name='wishes', to='wishlist.WishList')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DreamComeTrue',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('when', models.DateTimeField(auto_now_add=True, help_text='When the dream came true')),
|
||||||
|
('note', models.TextField(blank=True, help_text='Optional note, e.g. tracking number. Private, shown only to owner.')),
|
||||||
|
('item', models.ForeignKey(help_text='What wish has been fulfilled.', on_delete=django.db.models.deletion.CASCADE, to='wishlist.wisheditem')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,30 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
class WishList(models.Model):
|
||||||
|
|
||||||
|
# Meta class?
|
||||||
|
|
||||||
|
slug = models.SlugField(max_length=50, blank=False, primary_key=True, editable=False, help_text="URL suffix for this wishlist. Must not clash existing ones, nor be 'user' nor 'item'.")
|
||||||
|
name = models.TextField(help_text="The title of the wishlist.")
|
||||||
|
description = models.TextField(blank=True, help_text="Optional (public) description of the wishlist.")
|
||||||
|
owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, help_text="The user owning this wishlist.")
|
||||||
|
hidden = models.BooleanField(default=True, help_text="Whether to hide on the users' list of their wishlists.")
|
||||||
|
hide_granted = models.BooleanField(default=False, help_text="Whether to hide already fulfilled wishes.")
|
||||||
|
|
||||||
|
class WishedItem(models.Model):
|
||||||
|
|
||||||
|
# Meta class?
|
||||||
|
|
||||||
|
id = models.AutoField(primary_key=True)
|
||||||
|
name = models.TextField(help_text="Name of the wished item.")
|
||||||
|
description = models.TextField(help_text="Detailed description of the item, for example its specification.")
|
||||||
|
wishlists = models.ManyToManyField(WishList, related_name='wishes', help_text="Wishlists that this wish should be part of.")
|
||||||
|
|
||||||
|
# FIXME: create more sensible name...
|
||||||
|
class DreamComeTrue(models.Model):
|
||||||
|
|
||||||
|
item = models.ForeignKey(WishedItem, on_delete=models.CASCADE, help_text="What wish has been fulfilled.")
|
||||||
|
when = models.DateTimeField(auto_now_add=True, help_text="When the dream came true")
|
||||||
|
note = models.TextField(blank=True, help_text="Optional note, e.g. tracking number. Private, shown only to owner.")
|
||||||
|
|
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
@ -0,0 +1,8 @@
|
|||||||
|
from django.urls import path
|
||||||
|
from . import views as v
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
# path('user/<str:loginname>', ...),
|
||||||
|
# path('item/<int:id>', ...),
|
||||||
|
# path('<slug:slug>', ...),
|
||||||
|
]
|
@ -0,0 +1,3 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
Loading…
Reference in New Issue