How to display multiple database values in a single input?

Question:

I have a small problem for a few hours.
I’m working on an app that uses django python. (I’m new to Django)

I’m currently working on the Front-end, and I would like to display a first name and last name in an input. This works fine for two separate input but I would like to display the first name and last name in the same input.

I do not know how to do

<input style="background-color: blue;"{{form.user_first_name}}>

Thanks

Asked By: GotaKev

||

Answers:

try this

<input style="background-color:blue;" value="{{form.user_first_name.value}} {{form.user_last_name.value}}">

Refer the below links

https://docs.djangoproject.com/en/4.1/topics/forms/#looping-over-the-form-s-fields
https://docs.djangoproject.com/en/4.1/topics/forms/

Answered By: rahul.m
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.