Merge branch 'release/3.0.8'
This commit is contained in:
commit
8351fc0d0e
17
accounts/migrations/0002_address_accounts_address_all_key.py
Normal file
17
accounts/migrations/0002_address_accounts_address_all_key.py
Normal file
@ -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.'),
|
||||
),
|
||||
]
|
||||
@ -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(
|
||||
|
||||
@ -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']
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -18,13 +18,11 @@
|
||||
<section class="subscription-coffee">
|
||||
{% for product in product_list %}
|
||||
<div>
|
||||
<label><strong>{{ product }}</strong>
|
||||
<figure class="product__figure">
|
||||
<img class="product__image" src="{{ product.get_first_img.image.url }}">
|
||||
</figure>
|
||||
</label>
|
||||
<label>Quantity:</label>
|
||||
<input type="number" min="0" max="20" data-id="{{ product.pk }}" name="product_{{ product.name }}">
|
||||
<figure class="product__figure">
|
||||
<img class="product__image" src="{{ product.get_first_img.image.url }}">
|
||||
</figure>
|
||||
<strong>{{ product }}</strong>
|
||||
<input type="number" min="0" max="20" pattern="[0-9]*" data-id="{{ product.pk }}" name="product_{{ product.name }}" placeholder="Quantity">
|
||||
</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block head %}
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
<script>const stripe = Stripe({{ STRIPE_API_KEY }});</script>
|
||||
<script src="{% static 'scripts/subscriptions.js' %}" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="site__banner site__banner--site">
|
||||
<h1>Subscriptions</h1>
|
||||
<h4>SUBSCRIBE AND SAVE</h4>
|
||||
</div>
|
||||
<article>
|
||||
<section>
|
||||
<form method="post" class="subscription-create-form">
|
||||
{% csrf_token %}
|
||||
<div>
|
||||
<h4>Pick your coffee</h4>
|
||||
<div class="product__subscription-list">
|
||||
{% for product in product_list %}
|
||||
<div>
|
||||
<label>{{ product }}
|
||||
<figure class="product__figure">
|
||||
<img class="product__image" src="{{product.get_first_img.image.url}}" alt="{{product.get_first_img.image}}">
|
||||
</figure>
|
||||
</label>
|
||||
<label>Schedule</label>
|
||||
<select name="schedule">
|
||||
{% for var1 in iterable %}
|
||||
|
||||
{% endfor %}
|
||||
</select>
|
||||
<label>Quantity</label>
|
||||
<input type="number" min="0" max="20" name="product_{{ product.pk }}">
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="output">
|
||||
<h4>Pick your options</h4>
|
||||
{{ form.as_p }}
|
||||
<div class="cart__table-wrapper">
|
||||
<table class="cart__totals">
|
||||
<tr>
|
||||
<td>Retail total</td>
|
||||
<td><del class="retail-price"></del></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Save</td>
|
||||
<td>10%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Subscription total</th>
|
||||
<td><strong class="price"></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<p class="shipping"></p>
|
||||
<p>
|
||||
<input type="submit" value="Continue to payment">
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</article>
|
||||
{% endblock %}
|
||||
Loading…
x
Reference in New Issue
Block a user