search

Home  >  Q&A  >  body text

python - If I need to display other fields on the Django page, should I change the data table structure and add a field? Or search and add it in the view function, and then display it in tem.

If I need to display other fields on the Django page, should I change the data table structure and add a field? Or should it be displayed to tem after processing is completed in the view function? Which of the two methods is better at the system level? Can you introduce the advantages and disadvantages of these two methods? Any suggestions will help me

大家讲道理大家讲道理2705 days ago1083

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-06-30 09:56:23

    I don’t know if I understand you correctly...
    If: For this table, this field is a necessary attribute, then I personally recommend modifying the table and adding fields; and if it is only on a specific occasion (page) If you need to display this field additionally, you can do back-end processing (through setattr or other methods). For example, the page needs to display user information. By default, it already has name and age fields. If you need to add gender, you can modify the data table; if If you just need to display how many articles this person has published on a certain page, then you can do back-end processing.

    reply
    0
  • Cancelreply