Adds a demo RelatedField to the database to demonstrate reporting.
This commit is contained in:
parent
c1fab4fcc2
commit
737db640aa
3 changed files with 47 additions and 0 deletions
|
@ -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
|
||||
|
|
28
pinaxcon/registrasion/migrations/0002_auto_20161005_1823.py
Normal file
28
pinaxcon/registrasion/migrations/0002_auto_20161005_1823.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# -*- 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'),
|
||||
),
|
||||
]
|
|
@ -1,6 +1,18 @@
|
|||
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):
|
||||
|
|
Loading…
Reference in a new issue