1 # -*- coding: utf-8 -*- |
|
2 from __future__ import absolute_import |
|
3 |
|
4 #django |
|
5 from django.db import models |
1 from django.db import models |
6 from django.contrib.auth.models import User |
2 from django.contrib.auth.models import User |
7 |
3 |
8 #tagging |
|
9 from tagging import register |
4 from tagging import register |
10 from tagging.fields import TagField |
5 from tagging.fields import TagField |
11 from tagging.utils import parse_tag_input |
6 from tagging.utils import parse_tag_input |
|
7 |
|
8 from project.scipycon.base import models as base_models |
|
9 |
12 |
10 |
13 DURATION_CHOICES = ( |
11 DURATION_CHOICES = ( |
14 ('10', 'Lightning Talk (10 mins)'), |
12 ('10', 'Lightning Talk (10 mins)'), |
15 ('20', 'Short Talk (20 mins)'), |
13 ('20', 'Short Talk (20 mins)'), |
16 ('30', 'Standard Talk (30 mins)'), |
14 ('30', 'Standard Talk (30 mins)'), |
21 ('beginers', 'beginning programmer'), |
19 ('beginers', 'beginning programmer'), |
22 ('intermediate', 'intermediate programmer'), |
20 ('intermediate', 'intermediate programmer'), |
23 ('advanced', 'advanced programmer'), |
21 ('advanced', 'advanced programmer'), |
24 ) |
22 ) |
25 |
23 |
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 |
24 |
45 class Talk(models.Model): |
25 class Talk(base_models.Base): |
46 """Defines talks at *PyCon""" |
26 """Defines talks at SciPy.in |
|
27 """ |
|
28 |
47 slug = models.SlugField() |
29 slug = models.SlugField() |
|
30 |
48 speaker = models.ForeignKey(User) |
31 speaker = models.ForeignKey(User) |
|
32 |
49 authors_bio = models.TextField() |
33 authors_bio = models.TextField() |
|
34 |
50 contact = models.EmailField() |
35 contact = models.EmailField() |
|
36 |
51 title = models.CharField(max_length=1024) |
37 title = models.CharField(max_length=1024) |
|
38 |
52 abstract = models.TextField() |
39 abstract = models.TextField() |
53 # outline = models.TextField() |
40 |
54 topic = models.CharField(max_length=255, |
41 topic = models.CharField(max_length=255, blank=True) |
55 #choices=TOPIC_CHOICES, |
42 |
56 blank=True) |
|
57 # topic_other = models.CharField(max_length=255, blank=True) |
|
58 duration = models.CharField(max_length=3, choices=DURATION_CHOICES) |
43 duration = models.CharField(max_length=3, choices=DURATION_CHOICES) |
|
44 |
59 audience = models.CharField(max_length=32, choices=AUDIENCE_CHOICES, blank=True) |
45 audience = models.CharField(max_length=32, choices=AUDIENCE_CHOICES, blank=True) |
60 # audience_other = models.CharField(max_length=128, blank=True) |
46 |
61 approved = models.BooleanField(default=False) |
47 approved = models.BooleanField(default=False) |
|
48 |
62 submitted = models.DateTimeField(auto_now_add=True) |
49 submitted = models.DateTimeField(auto_now_add=True) |
|
50 |
63 last_mod = models.DateTimeField(auto_now=True) |
51 last_mod = models.DateTimeField(auto_now=True) |
64 # tags = TagField(blank=True) |
|
65 |
52 |
66 def __unicode__(self): |
53 def __unicode__(self): |
67 return self.title |
54 return self.title |
68 |
55 |
69 def get_tag_list(self): |
56 def get_tag_list(self): |
70 return parse_tag_input(self.tags) |
57 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 |
|