Some basic models and data
This commit is contained in:
parent
0e949d61d7
commit
4e7cbc5a96
6 changed files with 101 additions and 7 deletions
BIN
src/db.sqlite3
BIN
src/db.sqlite3
Binary file not shown.
40
src/wishlists/migrations/0001_initial.py
Normal file
40
src/wishlists/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Generated by Django 4.2.7 on 2023-11-27 22:52
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Wishlist',
|
||||
fields=[
|
||||
('id', models.UUIDField(primary_key=True, serialize=False)),
|
||||
('name', models.CharField(max_length=200)),
|
||||
('description', models.CharField(max_length=2000)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='WishlistItem',
|
||||
fields=[
|
||||
('id', models.UUIDField(primary_key=True, serialize=False)),
|
||||
('name', models.CharField(max_length=200)),
|
||||
('description', models.CharField(max_length=2000)),
|
||||
('url', models.CharField(max_length=2000)),
|
||||
('price', models.FloatField()),
|
||||
('image', models.CharField(blank=True, max_length=2000, null=True)),
|
||||
('gifted', models.BooleanField(default=False)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('wishlist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wishlists.wishlist')),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -0,0 +1,33 @@
|
|||
# Generated by Django 4.2.7 on 2023-11-27 23:02
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wishlists', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='wishlist',
|
||||
name='description',
|
||||
field=models.CharField(max_length=2000, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='wishlistitem',
|
||||
name='description',
|
||||
field=models.CharField(max_length=2000, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='wishlistitem',
|
||||
name='price',
|
||||
field=models.FloatField(null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='wishlistitem',
|
||||
name='url',
|
||||
field=models.CharField(max_length=2000, null=True),
|
||||
),
|
||||
]
|
|
@ -1,3 +1,28 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class Wishlist(models.Model):
|
||||
id = models.UUIDField(primary_key=True)
|
||||
name = models.CharField(max_length=200)
|
||||
description = models.CharField(max_length=2000, null=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name} ({self.id})"
|
||||
|
||||
|
||||
class WishlistItem(models.Model):
|
||||
id = models.UUIDField(primary_key=True)
|
||||
wishlist = models.ForeignKey(Wishlist, on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=200)
|
||||
description = models.CharField(max_length=2000, null=True)
|
||||
url = models.CharField(max_length=2000, null=True)
|
||||
price = models.FloatField(null=True)
|
||||
image = models.CharField(max_length=2000, blank=True, null=True)
|
||||
gifted = models.BooleanField(default=False)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name} ({self.id})"
|
||||
|
|
|
@ -31,7 +31,7 @@ ALLOWED_HOSTS = []
|
|||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
"django.contrib.admin",
|
||||
"wishlists.apps.WishlistsConfig",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
|
|
|
@ -14,10 +14,6 @@ Including another URLconf
|
|||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path("wishlist/", include("wishlists.urls")),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
urlpatterns = [path("wishlist/", include("wishlists.urls"))]
|
||||
|
|
Loading…
Reference in a new issue