What do you want to save?
Add Code snippet
New code examples
-
Other 2022-02-28 18:55:05
django forms views.py
from django.http import HttpResponseRedirect from django.shortcuts import render from .forms import NameForm def get_name(request): # if this is a POST request we need to process the form data if request.method == 'POST': # create a form... Add solution -
-
-
Python 2022-02-24 09:20:08
how to delete all instances of a model in django
from django.shortcuts import render from .models import Car def showthis(request): #deletes all objects from Car database table Car.objects.all().delete() context= {} return render(request, 'Blog/home.html', context) Add solution -
Python 2022-02-21 03:55:27
django psql setup
This gist I write, because I couldn't find step by step instructions how to install and start postgresql locally and not globally in the operating system (which would require sudo). I hope, this will help especially people new to postgresql! ##########... Add solution -
Python 2022-02-16 15:20:05
django telephone field
from django.core.validators import RegexValidator class PhoneModel(models.Model): ... phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.") ... Add solution