I edit the form, it loads the data correctly, buying, when I click save, it creates a new record in the database.
Here are the presentation functions
def create_account(request): if request.method == 'POST':
-
def edit_account(request, acc_id): f = Account.objects.get(pk=acc_id) if request.method == 'POST':
I really need to have a separate editing function and split by delete. Can i do everything in one function
template
<form action="/account/" method="post" enctype="multipart/form-data" > {% csrf_token %} {% for field in form %} <div class="fieldWrapper"> {{ field.errors }} {{ field.label_tag }}: {{ field }} </div> {% endfor %} <p><input type="submit" value="Send message" /></p> </form>
user2134226
source share