diff --git a/accounts/migrations/0002_address_accounts_address_all_key.py b/accounts/migrations/0002_address_accounts_address_all_key.py new file mode 100644 index 0000000..b8ef7b4 --- /dev/null +++ b/accounts/migrations/0002_address_accounts_address_all_key.py @@ -0,0 +1,17 @@ +# Generated by Django 4.1.5 on 2023-01-25 00:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0001_initial'), + ] + + operations = [ + migrations.AddConstraint( + model_name='address', + constraint=models.UniqueConstraint(fields=('first_name', 'last_name', 'street_address_1', 'street_address_2', 'city', 'state', 'postal_code'), name='accounts_address_all_key', violation_error_message='Duplicate: Address already exists.'), + ), + ] diff --git a/accounts/models.py b/accounts/models.py index f800495..63ef944 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -46,6 +46,23 @@ class Address(models.Model): yield ('postal_code', self.postal_code), yield ('country_code', 'US') + class Meta: + constraints = [ + models.UniqueConstraint( + name='accounts_address_all_key', + fields=[ + 'first_name', + 'last_name', + 'street_address_1', + 'street_address_2', + 'city', + 'state', + 'postal_code' + ], + violation_error_message='Duplicate: Address already exists.' + ) + ] + class User(AbstractUser): addresses = models.ManyToManyField( diff --git a/ptcoffee/settings.py b/ptcoffee/settings.py index af8c72b..f38cd99 100644 --- a/ptcoffee/settings.py +++ b/ptcoffee/settings.py @@ -40,7 +40,7 @@ SECRET_KEY = env( # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.bool('DEBUG', True) -ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', ['localhost']) +ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', ['*']) INTERNAL_IPS = ['127.0.0.1', '10.0.2.2' '172.27.0.4'] diff --git a/static/styles/main.css b/static/styles/main.css index d8d8b12..ad56e52 100644 --- a/static/styles/main.css +++ b/static/styles/main.css @@ -779,13 +779,21 @@ article + article { } .subscription-coffee div { - text-align: center; + min-width: 12rem; + display: flex; + flex-direction: column; + align-items: center; + gap: 1rem; } .subscription-coffee img { max-height: 300px; } +.subscription-coffee input[type=number] { + width: 100%; +} + .subscription-products { display: flex; gap: 2rem; diff --git a/storefront/templates/storefront/subscription/form.html b/storefront/templates/storefront/subscription/form.html index 17b1e18..0ac2452 100644 --- a/storefront/templates/storefront/subscription/form.html +++ b/storefront/templates/storefront/subscription/form.html @@ -18,13 +18,11 @@
{% for product in product_list %}
- - - +
+ +
+ {{ product }} +
{% endfor %}
diff --git a/storefront/templates/storefront/subscriptions.html b/storefront/templates/storefront/subscriptions.html deleted file mode 100644 index 73ffb92..0000000 --- a/storefront/templates/storefront/subscriptions.html +++ /dev/null @@ -1,68 +0,0 @@ -{% extends 'base.html' %} -{% load static %} - -{% block head %} - - - -{% endblock %} - -{% block content %} -
-

Subscriptions

-

SUBSCRIBE AND SAVE

-
-
-
-
- {% csrf_token %} -
-

Pick your coffee

-
- {% for product in product_list %} -
- - - - - -
- {% endfor %} -
-
-
-

Pick your options

- {{ form.as_p }} -
- - - - - - - - - - - - - -
Retail total
Save10%
Subscription total
-
-

-

- -

-
-
-
-
-{% endblock %}