i am looking for to make a page or view of Model.Admin page inside my website, so users with right permission can access my custom model.admin page with all of its functions/actions.
im talking about this page:
this
Related
Django shows list of model items in admin panel, but don't want to show the list but I directly want to show the detail view . How can i do this ?
I have a website running on Django that uses Wagtail for most of the pages (that are simply text content, editable through the Wagtail Admin UI). However, I have some content that needs to be dynamically rendered from my own Django model (let's say it's a list of handouts). I'd like that content to be rendered on a Wagtail page that would also have some Wagtail models (e.g., top menu, some introductory text). What's the best way to do this? I thought about making the list of handouts an API endpoint, and rendering it with JavaScript + XHR, but it seems like there should be a good way to do it server-side.
Assuming the introductionary text is a block in a Wagtail StreamField, you could also define a Wagtail Block that links to a Django model. https://pypi.org/project/wagtail-modelchooser/ is a useful extension that provides this functionality. This makes it possible to render things from Django model instances in your Wagtail stream content.
One option would be to create a property on your Page model that retrieves whatever you are looking for from this other model
# rest of your imports
...
from handouts import Handouts
class MyPage(Page):
# rest of your page's fields
...
#property
def get_handouts(self):
handouts = Handouts.objects.all()
return handouts
i want a button to call a view function from django admin. i want my button here my django admin panel
When i click on that button , it calls a specified view.
You have to override the default django admin template. Please read more here: https://docs.djangoproject.com/en/3.0/howto/overriding-templates/
For some reason when overriding the change_form.html template in Django Admin, its associated listview breadcrumb is grayed out and you can't click on it. Does anyone know how to make it available again? Thank you.
It turns out that #Dev use django v1.11 and template is from django v.2.2.
In new template, django use has_view_permission to determine if user is able to access model page in admin panel. However, in django 1.11 there was no view permission and no has_view_permission method, thus it was rendered gray.
I would like to make a custom admin page for one of my application with django. I've created a change_form.html and fieldset.html in admin/myapp/mymodel of my template folder. I am now able to customize the page.
mymodel has an ImageField and I would like to display this image on the page. I guess this is possible because the ImageField shows a link to the image on the page.
I am trying to modify the fieldset.html but unfortunately I don't know how to access the url in order to put in an img html tag. {{field.field.field}} shows an ImageField object but how to access the current value for this field?
Thanks in advance
<img src="{{field.field.field.url}}">
On a related note, instead of having to do all that, you could use django-form-utils that will provide you a thumbnail included display and clear-able file field, for free.
The current object can be accessed in a custom django admin template with {{original}}
It solves my problem