views:

121

answers:

1

I'm totally understanding the documentation on expanding the Comments app in Django, and really would like to stick with the automatic functionality but...

In the current app, I have absolutely no use for an "URL" to be submitted along with a comment.

Being minimally invasive of the default setup, how can I prevent this field from showing up with the comment form?

Using Django 1, or Trunk, and as many generic/built-ins as possible (generic views, default comments set up, etc. I have only a single generic view wrapper so far).

+4  A: 

This is well documented under customizing the comments framework.

All your app will use is get_form, returning a subclass of the CommentForm with the url field popped. Something like:

class NoURLCommentForm(CommentForm):
    """
    A comment form which matches the default djanago.contrib.comments one, but
    doesn't have a URL field.

    """
NoURLCommentForm.base_fields.pop('url')
SmileyChris
I agree the documentation is great, but I have to argue that finding my way to "base_fields" and using .pop() was not something I readily came across. Yes, the comments framework is well documented, but "this" is not. I agree that it's my responsibility to find that kind of thing, and I'm extremely grateful for your time and assistance! Thanks Bro!
anonymous coward