merged with sanj

This commit is contained in:
Johnson Chetty 2012-07-27 15:31:17 +02:00
parent da9c31dc13
commit 558123e623
4 changed files with 26 additions and 2 deletions

View File

@ -24,6 +24,12 @@ class PopupGroupForm(PopupForm):
model = TheatreGroup
fields = ('name', 'email',)
class PopupPlayForm(PopupForm):
class Meta:
model = Play
class PopupProductionForm(PopupForm):
group = forms.ModelChoiceField(TheatreGroup.objects.all(), widget=AutocompleteAddWidget(model_class=TheatreGroup))

View File

@ -248,6 +248,7 @@ class TheatreGroup(ItfModel):
added_by = models.ForeignKey(User)
name = models.CharField(max_length=255, db_index=True) # name + location is unique
email = models.EmailField(blank=True, null=True)
location = models.ForeignKey(Location, blank=True, null=True)
tel = models.IntegerField(blank=True, null=True)
nature_of_work = models.ManyToManyField("GroupOccupation", blank=True, null=True, through="GroupGroupOccupation")
languages = models.ManyToManyField("Language", blank=True, null=True)
@ -256,7 +257,6 @@ class TheatreGroup(ItfModel):
awards = models.ManyToManyField("Award", blank=True, null=True)
website = models.URLField(blank=True, verify_exists=False)
# resources = models.ManyToManyField("Resource", blank=True, null=True)
# city = models.CharField(max_length=255)
locations = models.ManyToManyField("Location", blank=True, null=True)
about = models.TextField(blank=True, null=True)

View File

@ -64,6 +64,8 @@ def personpopup(request):
})
return render_to_response("test/popup.html", context)
def autocomplete(request):
q = request.GET.get('q', 'a')
page = int(request.GET.get('page', '1'))
@ -78,3 +80,19 @@ def autocomplete(request):
'has_next': results.has_next()
})
def grouppopup(request):
form = PersonForm()
if request.POST:
return HttpResponse("<script>opener.dismissAddAnotherPopup(window, '%s', '%s')</script>" % ("45", "sanjay bhangar",))
form = PersonForm(request.POST, request.FILES)
if form.is_valid():
instance = form.save()
# return HttpResponse("<script>opener.dismissAddAnotherPopup(this, '%s', '%s')</script>" % (str(instance.id), instance.get_title()))
else:
form = PersonForm()
context = RequestContext(request, {
'form': form
})
return render_to_response("test/popup.html", context)

View File

@ -46,7 +46,7 @@ urlpatterns = patterns('',
(r'^autocomplete/(?P<ctype_id>\d+)', 'app.views.autocomplete'),
(r'^popup_form/(?P<ctype_id>\d+)', 'app.views.popup_form'),
# (r'^autocompletes/itfprofiles/$', 'itfprofiles.views.autocomplete'),
(r'^popup/person', 'itfprofiles.views.personpopup'),
(r'^popup/person', 'itfprofiles.views.personpopup'), (r'^popup/theatregroup', 'itfprofiles.views.grouppopup'),
# (r'i/', include('itfcore.urls')),
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^search/', include('haystack.urls')),