|
1 # -*- coding: utf-8 -*- |
|
2 from __future__ import absolute_import |
|
3 |
|
4 #django |
|
5 from django.db import models |
|
6 from django.contrib.auth.models import User |
|
7 |
|
8 #tagging |
|
9 from tagging import register |
|
10 from tagging.fields import TagField |
|
11 from tagging.utils import parse_tag_input |
|
12 |
|
13 DURATION_CHOICES = ( |
|
14 ('10', 'Lightning Talk (10 mins)'), |
|
15 ('20', 'Short Talk (20 mins)'), |
|
16 ('30', 'Standard Talk (30 mins)'), |
|
17 ) |
|
18 |
|
19 AUDIENCE_CHOICES = ( |
|
20 ('nonprogrammers', 'non-programmer'), |
|
21 ('beginers', 'beginning programmer'), |
|
22 ('intermediate', 'intermediate programmer'), |
|
23 ('advanced', 'advanced programmer'), |
|
24 ) |
|
25 |
|
26 #TOPIC_CHOICES = ( |
|
27 # ('Core Python', 'Core Python'), |
|
28 # ('Other implementations: Jython, IronPython, PyPy, and Stackless', 'Other implementations: Jython, IronPython, PyPy, and Stackless'), |
|
29 # ('Python libraries and extensions', 'Python libraries and extensions'), |
|
30 # ('Python 3k', 'Python 3k'), |
|
31 # ('Databases', 'Databases'), |
|
32 # ('Documentation', 'Documentation'), |
|
33 # ('GUI Programming', 'GUI Programming'), |
|
34 # ('Game Programming', 'Game Programming'), |
|
35 # ('Network Programming', 'Network Programming'), |
|
36 # ('Open Source Python projects', 'Open Source Python projects'), |
|
37 # ('Packaging Issues', 'Packaging Issues'), |
|
38 # ('Programming Tools', 'Programming Tools'), |
|
39 # ('Project Best Practices', 'Project Best Practices'), |
|
40 # ('Embedding and Extending', 'Embedding and Extending'), |
|
41 # ('Science and Maths', 'Science and Maths'), |
|
42 # ('Web-based Systems', 'Web-based Systems'), |
|
43 #) |
|
44 |
|
45 class Talk(models.Model): |
|
46 """Defines talks at *PyCon""" |
|
47 slug = models.SlugField() |
|
48 speaker = models.ForeignKey(User) |
|
49 authors_bio = models.TextField() |
|
50 contact = models.EmailField() |
|
51 title = models.CharField(max_length=1024) |
|
52 abstract = models.TextField() |
|
53 # outline = models.TextField() |
|
54 topic = models.CharField(max_length=255, |
|
55 #choices=TOPIC_CHOICES, |
|
56 blank=True) |
|
57 #topic_other = models.CharField(max_length=255, blank=True) |
|
58 duration = models.CharField(max_length=3, choices=DURATION_CHOICES) |
|
59 audience = models.CharField(max_length=32, choices=AUDIENCE_CHOICES, blank=True) |
|
60 # audience_other = models.CharField(max_length=128, blank=True) |
|
61 approved = models.BooleanField(default=False) |
|
62 submitted = models.DateTimeField(auto_now_add=True) |
|
63 last_mod = models.DateTimeField(auto_now=True) |
|
64 # tags = TagField(blank=True) |
|
65 |
|
66 def __unicode__(self): |
|
67 return self.title |
|
68 |
|
69 def get_tag_list(self): |
|
70 return parse_tag_input(self.tags) |
|
71 |
|
72 # register(Talk) # saving talk failed - see: |
|
73 # http://code.google.com/p/django-tagging/issues/detail?id=152 |