I have developed some code that builds on the contrib comments app, such as handlers for ajax requests. This code is in a separate application, which we can call 'comments2'. the url configuration of the project is structured in such a way that all calls to /comments are directed to this app's views. This works without problems.
Very recently I made a new page that shows comments flagged as inappropriate.
I conceived that it was best done by writing an inclusion templatetag, and wrote one. It works like this:
{% display_flagged_comments 'market' %}
This tag is placed inside the main app's relevant template.
As seen in the code above, I pass what model (Market in this case) the comments belongs to so that the comments2 app remains generic.
I have three issues here that I need guidance on:
First, I feel that the model argument being inside quotes ('market') make the code somewhat less elegant. In the code the argument is converted to a model:
#template tag
def show_comments(modelname):
model = ContentType.objects.get(model=modelname)
... # get comments and return them
Second, since all requests with /comments are directed to comment2 app, I need to devise a different url for this page (it sits inside the main app), such as /managecomments. I find doing that also inelegant.
Third, I want to know if I followed a correct path or is there a better way to implement what I'm trying to do.
Thanks in advance.