[Django] #21329: Django from viewe conditionaly

2 views
Skip to first unread message

Django

unread,
Oct 25, 2013, 1:10:53 AM10/25/13
to django-...@googlegroups.com
#21329: Django from viewe conditionaly
-------------------------------+--------------------
Reporter: suvankar | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.4
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
in a from i have display four field

first name
last name
promocode
email

when i click submit button this will return a another where another
from will open and fetch data from data base ]

i want to display data conditionaly when user put promocode in firstfrom
at first i want to check this promocode will start with 4(as example
44444)
then we redirect an page valid.html otherwise we redirect result.htmlhow
to do this
please healp

my viewes.py

class Registerview(FormView,ListView):
template_name = "valid.html"
model = Customers
form_class = PromoModelForm

def get(self, request, *args, kwargs):
week = Customers.objects.all()
try:
p=Customers.objects.get(PROMOCODE=request.GETPROMOCODE?)
wer=Customers.objects.filter(PROMOCODE=request.GETPROMOCODE?)
if request.method == 'POST': # If the form has been submitted...
form = PromoModelForm(request.POST, request.FILES, instance=wer) # A form
bound to the POST data
if form.is_valid(): # All val
x = {'form': form, }
raise Http404
except Customers.DoesNotExist:
raise Http404
else:
form = PromoModelForm(instance=p) # An unbound form
x = RequestContext(request,{
'week':week,
'form':form
})
return render_to_response('valid.html',x, context_instance =
RequestContext(request))

and my urls.py is
url(r'register/?$', Registerview.as_view()),

--
Ticket URL: <https://code.djangoproject.com/ticket/21329>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 25, 2013, 1:12:36 AM10/25/13
to django-...@googlegroups.com
#21329: Django from viewe conditionaly
-------------------------------+--------------------------------------
Reporter: suvankar | Owner: suvankar
Type: Uncategorized | Status: assigned
Component: Uncategorized | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by suvankar):

* owner: nobody => suvankar
* needs_docs: => 0
* status: new => assigned
* needs_tests: => 0
* needs_better_patch: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/21329#comment:1>

Django

unread,
Oct 25, 2013, 5:27:20 AM10/25/13
to django-...@googlegroups.com
#21329: Django from viewe conditionaly
-------------------------------+--------------------------------------
Reporter: suvankar | Owner: suvankar
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.4
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by claudep):

* status: assigned => closed
* resolution: => invalid


Comment:

Sorry, but the ticket system is not a support channel. See
wiki:TicketClosingReasons/UseSupportChannels

--
Ticket URL: <https://code.djangoproject.com/ticket/21329#comment:2>

Reply all
Reply to author
Forward
0 new messages