events model / form

This commit is contained in:
Sanjay B 2013-02-03 02:58:28 +05:30
parent 44c871f15b
commit 627968b777
4 changed files with 36 additions and 17 deletions

View File

@ -24,7 +24,9 @@ GroupEventInline = itf_inlineformset_factory(Event, GroupEvent, form=GroupEventF
class EventForm(ItfForm):
inlines = [PersonEventInline, GroupEventInline]
parent_event = forms.ModelChoiceField(Event.objects.all(), widget=AutocompleteAddWidget(model_class=Event))
production = forms.ModelChoiceField(Production.objects.all(), widget=AutocompleteAddWidget(model_class=Production))
class Meta:
model = Event
exclude = ('people', 'groups',)

View File

@ -6,23 +6,38 @@ from django.contrib.localflavor.in_.forms import INZipCodeField
#from ox.django.fields import DictField
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from itfprofiles.models import Location, Production, TheatreGroup, Person
from itfprofiles.models import City, Location, Production, TheatreGroup, Person
EVENT_TYPE_CHOICES = (
('workshop', 'Workshop'),
('talk', 'Talk'),
('performance', 'Performance'),
('festival', 'Festival'),
('other', 'Other'),
)
class Event(ItfModel):
#ItfModel stuff:
form_names = ['EventForm']
main_form = 'EventForm'
fts_fields = ['title', 'oneliner', 'description']
added_by = models.ForeignKey(User, editable=False, null=True, blank=True)
title = models.CharField(max_length=1024)
oneliner = models.CharField(max_length=1024,help_text="Event slogan/one liner")
event_type = models.CharField(choices=EVENT_TYPE_CHOICES, max_length=64)
oneliner = models.CharField(max_length=1024,help_text="Event slogan/one liner", blank=True)
description = models.TextField(blank=True, null=True)
locations = generic.GenericRelation(Location)
start_date = models.DateTimeField()
end_date = models.DateTimeField()
booking_link = models.URLField(blank=True, null=True, help_text="Ticket booking")
parent_event = models.ForeignKey("Event", related_name='child_events', help_text='If this event is part of another event', blank=True, null=True)
city = models.ForeignKey(City)
address = models.TextField(blank=True)
# location = models.ForeignKey(Location)
# locations = generic.GenericRelation(Location)
start_date = models.DateField()
end_date = models.DateField(null=True, blank=True, help_text='If event is on a single day, leave blank')
start_time = models.TimeField(null=True, blank=True)
end_time = models.TimeField(null=True, blank=True)
booking_link = models.URLField(blank=True, null=True, help_text="Ticket booking link, if applicable")
tel_no = models.CharField(max_length=100, blank=True)
production = models.ForeignKey(Production, blank=True, null=True, help_text="If this is a showing of a production...")
people = models.ManyToManyField(Person, blank=True, null=True, through="PersonEvent")
@ -77,13 +92,13 @@ class GroupEvent(models.Model):
typ = models.CharField(choices=GROUP_EVENT_CHOICES, max_length=128)
class Connection(models.Model):
link_type = models.CharField(max_length=255)
extra_text = models.CharField(max_length=1024)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
#class Connection(models.Model):
# link_type = models.CharField(max_length=255)
# extra_text = models.CharField(max_length=1024)
# content_type = models.ForeignKey(ContentType)
# object_id = models.PositiveIntegerField()
# content_object = generic.GenericForeignKey('content_type', 'object_id')
def __unicode__(self):
return self.link_type
# def __unicode__(self):
# return self.link_type

View File

@ -236,6 +236,7 @@ STATE_CHOICES= (
class City(models.Model):
name = models.CharField(max_length=255)
state = models.CharField(choices = STATE_CHOICES, max_length=255)
def __unicode__(self):
return self.name

View File

@ -20,7 +20,8 @@ django-crispy-forms
django-floppyforms
django-markitup
twitter
-e git+git://github.com/pennersr/django-allauth.git#egg=django-allauth
#-e git+git://github.com/pennersr/django-allauth.git#egg=django-allauth
-e git://github.com/pennersr/django-allauth.git@92f3ebe231267bffba53c6c0c1d4eb6e13755bb5#egg=django_allauth-0.6.0-py2.7-dev
-e git+git://github.com/pythonforfacebook/facebook-sdk.git#egg=facebook-sdk
django-comments-xtd
django-avatar