Doubt in the creation of fields in the FrontEnd

27 views
Skip to first unread message

Barkalez XX

unread,
Mar 23, 2019, 12:45:24 PM3/23/19
to Django users

I would like to know if it is possible to create a new field in a table from the FrontEnd. For example, in a form to create recipes, not all recipes contain the same number of ingredients. At first I thought about putting a high number of ingredients to enter in the form to create a recipe, but that's not pretty. I think it would be better for the user to add fields in the form as needed. Although thinking well, if that were done, who would execute the command makemigrations and migrate ?, it occurred to me to create a high number of fields for the ingredients but that did not appear in the FrontEnd form and that they were appearing as needed by the user.

Aldian Fazrihady

unread,
Mar 23, 2019, 12:54:24 PM3/23/19
to django...@googlegroups.com
Hi,

I don't think that's a good idea to frequently add new field to a database table.

A field in form doesn't mean that it will also be a field of a table database.
You can make a new ingredient field in a form to become a new row of a database table.
You just need to properly design your database schema.

Regards,

Aldian Fazrihady

On Sun, Mar 24, 2019 at 12:46 AM Barkalez XX <bark...@gmail.com> wrote:

I would like to know if it is possible to create a new field in a table from the FrontEnd. For example, in a form to create recipes, not all recipes contain the same number of ingredients. At first I thought about putting a high number of ingredients to enter in the form to create a recipe, but that's not pretty. I think it would be better for the user to add fields in the form as needed. Although thinking well, if that were done, who would execute the command makemigrations and migrate ?, it occurred to me to create a high number of fields for the ingredients but that did not appear in the FrontEnd form and that they were appearing as needed by the user.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c416f450-0172-45e2-9242-4704c4aca421%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Barkalez XX

unread,
Mar 23, 2019, 1:53:49 PM3/23/19
to Django users
Thank for you answer.


I did not know that fields could be generated in the database from FrontEnd.


It occurs to me to put a "Add ingredient" button and produce a new field in the recipe table, but I do not know how to do that.

Aldian Fazrihady

unread,
Mar 23, 2019, 2:16:47 PM3/23/19
to django...@googlegroups.com

Hi,

Generating fields is possible,

but for your recipe app, that's absolutely not a good thing to do.

Regards,

Aldian Fazrihady

Barkalez XX

unread,
Mar 23, 2019, 2:21:33 PM3/23/19
to Django users
Then it occurs to me to create a table called List Ingredients and relate it to the recipe.
Reply all
Reply to author
Forward
0 new messages