fixes + deprecated migration

This commit is contained in:
Ludovic Stephan 2016-09-05 02:38:46 +02:00
parent 3bc9880db1
commit de522a0035
3 changed files with 5 additions and 41 deletions

View file

@ -8,6 +8,7 @@ from datetime import timedelta
from django import forms
from django.forms.models import BaseInlineFormSet
from django.db.models import Q
from django.utils import timezone
from bda.models import Attribution, Spectacle
@ -67,8 +68,9 @@ class AnnulForm(forms.Form):
self.fields['attributions'].queryset = participant.attribution_set\
.filter(spectacle__date__gte=timezone.now(),
revente__isnull=False,
revente__date__gte=timezone.now()-timedelta(hours=1),
revente__seller=participant)
revente__date__gte=timezone.now()-timedelta(hours=1))\
.filter(Q(revente__soldTo__isnull=True) |
Q(revente__soldTo=participant))
class InscriptionReventeForm(forms.Form):

View file

@ -1,38 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('bda', '0007_extends_spectacle'),
]
operations = [
migrations.CreateModel(
name='SpectacleRevente',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Date de mise en vente')),
('attribution', models.OneToOneField(related_name='revente', to='bda.Attribution')),
],
),
migrations.AddField(
model_name='participant',
name='choicesrevente',
field=models.ManyToManyField(related_name='revente', to='bda.Spectacle', blank=True),
),
migrations.AddField(
model_name='spectaclerevente',
name='interested',
field=models.ManyToManyField(related_name='wanted', to='bda.Participant', blank=True),
),
migrations.AddField(
model_name='spectaclerevente',
name='soldTo',
field=models.ForeignKey(blank=True, to='bda.Participant', null=True),
),
]

View file

@ -12,7 +12,7 @@
{% if shotgun %}
<br>
<h3>Places disponibles immédiatement</h3>
<ul>
<ul class="list-unstyled">
{% for spectacle in shotgun %}
<li><a href="{% url "bda-buy-revente" spectacle.id %}">{{spectacle}}</a></li>
{% endfor %}