Skip to content

Instantly share code, notes, and snippets.

@CoutinhoElias
Created April 19, 2018 20:03
Show Gist options
  • Save CoutinhoElias/529634bf859f5d203b93529711219837 to your computer and use it in GitHub Desktop.
Save CoutinhoElias/529634bf859f5d203b93529711219837 to your computer and use it in GitHub Desktop.
MeuCodigoPython
#View bookings_create
def bookings_create(request):
data = dict()
if request.method == 'POST':
form = BookingsForm(request.POST)
if form.is_valid():
form.save()
data['form_is_valid'] = True
else:
data['form_is_valid'] = False
else:
form = BookingsForm()
form = BookingsForm()
context = {'form': form}
data['html_form'] = render_to_string('bookings_create.html',
context,
request=request,
)
return JsonResponse(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment