Commit b82918b5 authored by Amap's avatar Amap

Modification des relations pour requests

parent 4159d9e0
......@@ -42,7 +42,7 @@ INSTALLED_APPS = (
'users',
'panier',
'amap',
# 'search',
'search',
'reversion'
)
......
......@@ -5,6 +5,7 @@ from django.forms import ModelForm, Form
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.core.validators import MaxValueValidator, MinValueValidator
class Panier(models.Model):
prix = models.DecimalField(max_digits=5, decimal_places=2)
......@@ -16,7 +17,7 @@ class Panier(models.Model):
class Commande(models.Model):
user = models.ForeignKey('users.User', on_delete=models.PROTECT)
nom = models.CharField(max_length=255)
quantite = models.IntegerField()
quantite = models.PositiveIntegerField(validators=[MinValueValidator(1)])
prix_unitaire = models.DecimalField(max_digits=5, decimal_places=2)
livre = models.BooleanField(default=False)
date = models.ForeignKey('Livraison', on_delete=models.PROTECT)
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('users', '0006_user_sac_consignes'),
]
operations = [
migrations.AlterField(
model_name='request',
name='user',
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
),
]
......@@ -190,7 +190,7 @@ class Request(models.Model):
)
type = models.CharField(max_length=2, choices=TYPE_CHOICES)
token = models.CharField(max_length=32)
user = models.ForeignKey('User', on_delete=models.PROTECT)
user = models.ForeignKey('User', on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True, editable=False)
expires_at = models.DateTimeField()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment