diff --git a/src/db.sqlite3 b/src/db.sqlite3 index eb6eeb7..10b17e9 100644 Binary files a/src/db.sqlite3 and b/src/db.sqlite3 differ diff --git a/src/wishlists/migrations/0001_initial.py b/src/wishlists/migrations/0001_initial.py new file mode 100644 index 0000000..9241fec --- /dev/null +++ b/src/wishlists/migrations/0001_initial.py @@ -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')), + ], + ), + ] diff --git a/src/wishlists/migrations/0002_alter_wishlist_description_and_more.py b/src/wishlists/migrations/0002_alter_wishlist_description_and_more.py new file mode 100644 index 0000000..dbb0abe --- /dev/null +++ b/src/wishlists/migrations/0002_alter_wishlist_description_and_more.py @@ -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), + ), + ] diff --git a/src/wishlists/models.py b/src/wishlists/models.py index 71a8362..81d2c05 100644 --- a/src/wishlists/models.py +++ b/src/wishlists/models.py @@ -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})" diff --git a/src/zauberkiste/settings.py b/src/zauberkiste/settings.py index ab4d5e3..e342bc0 100644 --- a/src/zauberkiste/settings.py +++ b/src/zauberkiste/settings.py @@ -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", diff --git a/src/zauberkiste/urls.py b/src/zauberkiste/urls.py index bd20d4c..2af8a93 100644 --- a/src/zauberkiste/urls.py +++ b/src/zauberkiste/urls.py @@ -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"))]