Between app.py, url.py, modules.py .... what do you do “IN ORDER” to creating a object (class) to show up in the admin?
I tried a test, but when I clicked on it... I came up as a error and it dosnt really day what it was.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (9)
So you have
Person
in models.py which is the model you want to show up in admin.You create a file
admin.py
in which you import your model, register it with the decorator and declare which fields will show up where.Read the Django admin model doc so you can use other field options, like inline which is very useful when you want to link fields from other models.
Can I use templates and render HTML instead of a class?
Since an admin is a really comon component of a website, Django takes care of it and render everything. All you have to do is register your model as an admin model and that's it.
Ok, is there just one Admin.py?
There should be one admin per appliction in your project.
So for each App? I only see one admin, I created a products app and a test app
Yes, when you run
python manage.py startapp projectApp
it creates an app with all the required files. If it's not there, just create it under the app folder you want it.Thank you! I actually followed the same steps as a different test project, and it works where I can add a product. But this isn’t working yet
Now in your list.
I create model then add it to admin.py for each app.