Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom django comments admin slot
    text
    copied!<p>So I am using Djangos builtin comments app (django.contrib.comments) for my blog application. I made several changes to the forms display, etc. (as described in the documentation). One last thing that bothers me is that the Comments model is in it's own category in the admin, like this:</p> <blockquote> <p>MyApp<br> ---Model1<br> ---Modle2</p> <p>Comments<br> ---Comments</p> </blockquote> <p>I want it to be like this since the comments are tied to the MyApp models.</p> <blockquote> <p>MyApp<br> ---Model1<br> ---Modle2<br> ---Comments</p> </blockquote> <p>I tried to achieve this by adding this line of code to MyApps admin.py (overwriting the Comment class)</p> <pre><code>class MyAppComment(Comment): class Meta(Comment.Meta): app_label = 'myapp' admin.site.unregister(Comment) admin.site.register(MyAppComment, CommentsAdmin) </code></pre> <p>And this works (and the Comments model shows up under MyApps) but now the links are wrong...the model points to:</p> <blockquote> <p><a href="http://www.mysite.com/admin/myapp/myappcomment/" rel="nofollow">http://www.mysite.com/admin/myapp/myappcomment/</a></p> </blockquote> <p>which outputs an error:</p> <blockquote> <p>no such table: myapp_myappcomment</p> </blockquote> <p>instead of:</p> <blockquote> <p><a href="http://www.mysite.com/admin/comments/comment/" rel="nofollow">http://www.mysite.com/admin/comments/comment/</a></p> </blockquote> <p>This is because the admin forms it's urls according to app names and model names...how could I just change the position of the Comments model in the admin but leave the urls as they are?</p> <p>There must be some way to do it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload