0001_initial.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # Generated by Django 5.0 on 2023-12-26 04:46
  2. import django.db.models.deletion
  3. from django.conf import settings
  4. from django.db import migrations, models
  5. class Migration(migrations.Migration):
  6. initial = True
  7. dependencies = [
  8. migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  9. ]
  10. operations = [
  11. migrations.CreateModel(
  12. name="Product",
  13. fields=[
  14. (
  15. "id",
  16. models.BigAutoField(
  17. auto_created=True,
  18. primary_key=True,
  19. serialize=False,
  20. verbose_name="ID",
  21. ),
  22. ),
  23. ("title", models.CharField(max_length=255)),
  24. ("description", models.TextField()),
  25. ("image", models.ImageField(upload_to="product_images/")),
  26. ("price", models.DecimalField(decimal_places=2, max_digits=10)),
  27. ],
  28. ),
  29. migrations.CreateModel(
  30. name="Order",
  31. fields=[
  32. (
  33. "id",
  34. models.BigAutoField(
  35. auto_created=True,
  36. primary_key=True,
  37. serialize=False,
  38. verbose_name="ID",
  39. ),
  40. ),
  41. ("order_date", models.DateTimeField(auto_now_add=True)),
  42. (
  43. "user",
  44. models.ForeignKey(
  45. on_delete=django.db.models.deletion.CASCADE,
  46. to=settings.AUTH_USER_MODEL,
  47. ),
  48. ),
  49. (
  50. "product",
  51. models.ForeignKey(
  52. on_delete=django.db.models.deletion.CASCADE, to="shop.product"
  53. ),
  54. ),
  55. ],
  56. ),
  57. migrations.CreateModel(
  58. name="UserProfile",
  59. fields=[
  60. (
  61. "id",
  62. models.BigAutoField(
  63. auto_created=True,
  64. primary_key=True,
  65. serialize=False,
  66. verbose_name="ID",
  67. ),
  68. ),
  69. ("avatar", models.ImageField(upload_to="user_avatars/")),
  70. (
  71. "user",
  72. models.OneToOneField(
  73. on_delete=django.db.models.deletion.CASCADE,
  74. to=settings.AUTH_USER_MODEL,
  75. ),
  76. ),
  77. ],
  78. ),
  79. ]