[Answer]-Django โ€“ Pass Data from View to Db to allow use in View

1๐Ÿ‘

โœ…

You could call scanprocess directly or simply just pass it by GET:

if form.is_valid(): # If form input passes initial validation...
    domainNm = form.cleaned_data['domainNm']  ## clean data in dictionary
    form.save() #save cleaned data to the db from dictionary

    try:
        return HttpResponseRedirect('/Scanprocess/?domainNm=' + domainNm)
    except:
        raise ValidationError(_('Invalid domain name'), code='invalid')

Then in your view you can just get it through request.GET.get('domainNm', '')

And so far as I know all you need is in the urls.py is:

url(r'^Scanprocess/$', name_of_view),
๐Ÿ‘คdan-klasson

Leave a comment