Answers for "django populate form from database"

0

django populate form from database

from django.forms.models import model_to_dict

def view(request):
    game = Game.objects.get(id=1)
    form = UserQueueForm(initial=model_to_dict(game))
    return render_to_response('my_template.html', {'form': form})
Posted by: Guest on July-15-2020

Code answers related to "django populate form from database"

Python Answers by Framework

Browse Popular Code Answers by Language