Changeset - 737db640aaeb
[Not reviewed]
0 2 1
Christopher Neugebauer - 4 years ago 2016-10-06 17:53:38
chrisjrn@gmail.com
Adds a demo RelatedField to the database to demonstrate reporting.
3 files changed with 47 insertions and 0 deletions:
0 comments (0 inline, 0 general)
pinaxcon/registrasion/admin.py
Show inline comments
...
 
@@ -7,3 +7,7 @@ from django.utils.translation import ugettext_lazy as _
 
class UserProfileAdmin(admin.ModelAdmin):
 
    model = models.AttendeeProfile
 
    list_display = ("name", "company", "name_per_invoice")
 

	
 
@admin.register(models.DynamicValues)
 
class DynamicValuesAdmin(admin.ModelAdmin):
 
    pass
pinaxcon/registrasion/migrations/0002_auto_20161005_1823.py
Show inline comments
 
new file 100644
 
# -*- coding: utf-8 -*-
 
# Generated by Django 1.9.2 on 2016-10-05 18:23
 
from __future__ import unicode_literals
 

	
 
from django.db import migrations, models
 

	
 

	
 
class Migration(migrations.Migration):
 

	
 
    dependencies = [
 
        ('pinaxcon_registrasion', '0001_initial'),
 
    ]
 

	
 
    operations = [
 
        migrations.CreateModel(
 
            name='DynamicValues',
 
            fields=[
 
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
 
                ('name', models.CharField(max_length=64)),
 
                ('value', models.IntegerField()),
 
            ],
 
        ),
 
        migrations.AddField(
 
            model_name='attendeeprofile',
 
            name='db_defined_values',
 
            field=models.ManyToManyField(to='pinaxcon_registrasion.DynamicValues'),
 
        ),
 
    ]
pinaxcon/registrasion/models.py
Show inline comments
 
from django.db import models
 
from django.utils.encoding import python_2_unicode_compatible
 
from registrasion import models as rego
 

	
 

	
 
@python_2_unicode_compatible
 
class DynamicValues(models.Model):
 

	
 
    name = models.CharField(max_length=64)
 
    value = models.IntegerField()
 

	
 
    def __str__(self):
 
        return "%s - %d" % (self.name, self.value)
 

	
 

	
 
class AttendeeProfile(rego.AttendeeProfileBase):
 

	
 
    @classmethod
...
 
@@ -74,6 +86,9 @@ class AttendeeProfile(rego.AttendeeProfileBase):
 
        max_length=64,
 
        blank=True,
 
    )
 
    db_defined_values = models.ManyToManyField(
 
        DynamicValues
 
    )
 

	
 

	
 
class DemoPayment(rego.PaymentBase):
0 comments (0 inline, 0 general)