Changeset - cd77380eac27
[Not reviewed]
0 2 2
Tobias - 5 years ago 2019-01-21 19:16:38
tobiasschulmann@catalyst.net.nz
Add hidden flag to raffle
4 files changed with 43 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pinaxcon/raffle/migrations/0003_raffle_hidden.py
Show inline comments
 
new file 100644
 
# -*- coding: utf-8 -*-
 
# Generated by Django 1.11.14 on 2019-01-21 19:15
 
from __future__ import unicode_literals
 

	
 
from django.db import migrations, models
 

	
 

	
 
class Migration(migrations.Migration):
 

	
 
    dependencies = [
 
        ('pinaxcon_raffle', '0002_auto_20190102_1205'),
 
    ]
 

	
 
    operations = [
 
        migrations.AddField(
 
            model_name='raffle',
 
            name='hidden',
 
            field=models.BooleanField(default=True),
 
        ),
 
    ]
pinaxcon/raffle/models.py
Show inline comments
...
 
@@ -2,24 +2,25 @@ from django.db import models
 

	
 
from pinaxcon.raffle.mixins import PrizeMixin, RaffleMixin
 

	
 

	
 
class Raffle(RaffleMixin, models.Model):
 
    """
 
    Stores a single Raffle object, related to one or many
 
    :model:`pinaxcon_registrasion.Product`, which  is usually a raffle ticket,
 
    but can be set to tickets or other products for door prizes.
 
    """
 
    description = models.CharField(max_length=255)
 
    products = models.ManyToManyField('registrasion.Product')
 
    hidden = models.BooleanField(default=True)
 

	
 
    def __str__(self):
 
        return self.description
 

	
 

	
 
class Prize(PrizeMixin, models.Model):
 
    """
 
    Stores a Prize for a given :model:`pinaxcon_raffle.Raffle`.
 

	
 
    Once `winning_ticket` has been set to a :model:`pinaxcon_raffle.DrawnTicket`
 
    object, no further changes are permitted unless the object is explicitely
 
    unlocked.
pinaxcon/templates/raffle_draw.html
Show inline comments
 
{% extends "registrasion/base.html" %}
 
{% load registrasion_tags %}
 
{% load lca2018_tags %}
 
{% load staticfiles %}
 

	
 
{% block header_title %}{% conference_name %}{% endblock %}
 

	
 
{% block proposals_body %}
 
<h1 class="mb-5">Raffle Winners</h1>
 

	
 
{% for raffle in raffles %}
 
{% if raffle.hidden %}
 
{% else %}
 
<h2 class="mt-5">{{ raffle }}</h2>
 

	
 
<dl class="row my-4">
 
  {% for prize in raffle.prizes.all %}
 
  <dt class="col-sm-3 text-truncate">{{ prize }}</dt>
 
  <dd class="col-sm-9">
 
    {% if prize.winning_ticket %}
 
    {% with prize.winning_ticket as winner %}
 
    {# this should be attendee name #}
 
    {% with winner.lineitem.invoice.user.attendee.attendeeprofilebase as profile %}
 
    <p><strong>Winning ticket {{ winner.ticket }}, {{ profile.attendee_name }}</strong><br />
 
      Drawn by {{ winner.draw.drawn_by }}, {{ winner.draw.drawn_time}}
...
 
@@ -42,17 +44,17 @@
 
  {% endfor %}
 
</dl>
 

	
 
{% if raffle.is_open %}
 
<form method="POST" action="{% url 'raffle-draw' raffle_id=raffle.id %}">
 
    {% csrf_token %}
 
    <p class="text-center">
 
      <button type="submit" class="btn btn-success">Draw tickets</button>
 
    </p>
 
    <div class="clearfix"></div>
 
  </form>
 
{% endif %}
 

	
 
{% if not forloop.last %}<hr>{% endif %}
 
{% endif %}
 
{% endfor %}
 

	
 
{% endblock %}
...
 
\ No newline at end of file
vendor/symposion/schedule/migrations/0008_auto_20190122_0815.py
Show inline comments
 
new file 100644
 
# -*- coding: utf-8 -*-
 
# Generated by Django 1.11.14 on 2019-01-21 19:15
 
from __future__ import unicode_literals
 

	
 
from django.db import migrations
 

	
 

	
 
class Migration(migrations.Migration):
 

	
 
    dependencies = [
 
        ('symposion_schedule', '0007_auto_20161224_1709'),
 
    ]
 

	
 
    operations = [
 
        migrations.AlterModelOptions(
 
            name='slot',
 
            options={'ordering': ['day__schedule__section__name', 'day', 'start'], 'verbose_name': 'slot', 'verbose_name_plural': 'slots'},
 
        ),
 
    ]
0 comments (0 inline, 0 general)