From 558123e623bf45d710d85be934fafd16239cf3b4 Mon Sep 17 00:00:00 2001 From: Johnson Chetty Date: Fri, 27 Jul 2012 15:31:17 +0200 Subject: [PATCH] merged with sanj --- itf/itfprofiles/forms.py | 6 ++++++ itf/itfprofiles/models.py | 2 +- itf/itfprofiles/views.py | 18 ++++++++++++++++++ itf/urls.py | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/itf/itfprofiles/forms.py b/itf/itfprofiles/forms.py index 9139534..4cf9898 100644 --- a/itf/itfprofiles/forms.py +++ b/itf/itfprofiles/forms.py @@ -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)) diff --git a/itf/itfprofiles/models.py b/itf/itfprofiles/models.py index f395040..10ac2c0 100644 --- a/itf/itfprofiles/models.py +++ b/itf/itfprofiles/models.py @@ -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) diff --git a/itf/itfprofiles/views.py b/itf/itfprofiles/views.py index 502e2e1..e326a28 100644 --- a/itf/itfprofiles/views.py +++ b/itf/itfprofiles/views.py @@ -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("" % ("45", "sanjay bhangar",)) + form = PersonForm(request.POST, request.FILES) + if form.is_valid(): + instance = form.save() +# return HttpResponse("" % (str(instance.id), instance.get_title())) + else: + form = PersonForm() + context = RequestContext(request, { + 'form': form + }) + return render_to_response("test/popup.html", context) diff --git a/itf/urls.py b/itf/urls.py index 6759944..f5082a6 100755 --- a/itf/urls.py +++ b/itf/urls.py @@ -46,7 +46,7 @@ urlpatterns = patterns('', (r'^autocomplete/(?P\d+)', 'app.views.autocomplete'), (r'^popup_form/(?P\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')),