Hi,

I am trying to have a simple comment form for loged in user with only
one textArea field,
I went the way of COMMENTS_APP = 'private_comments' insettings and
using my own forms.py with the following code:

class PrivateComment(CommentForm):

    def __init__(self, *args, **kwargs):
        super(CommentFormWithTitle, self).__init__(*args, **kwargs)
        self.fields.keyOrder = [ 'comment', 'honeypot',
'content_type', 'object_pk', 'timestamp', 'security_hash']


    def get_comment_model(self):
        # Use our custom comment model instead of the built-in one.
        return PrivateComment

    def get_comment_create_data(self):
        # Use the data of the superclass, and add in the title field
        #data = super(CommentFormWithTitle,
self).get_comment_create_data()
        return dict(
            content_type = ContentType.objects.get_for_model
(self.target_object),
            object_pk    = force_unicode(self.target_object._get_pk_val
()),
            user_name    = "",
            user_email   = "",
            user_url     = "",
            comment      = self.cleaned_data["comment"],
            submit_date  = datetime.datetime.now(),
            site_id      = settings.SITE_ID,
            is_public    = True,
            is_removed   = False,
        )

however i feel like i am heading the wrong way, i saw that if a user
si logged in the email and user field of comment model will be
automatically assigned.

Therefore maybe i just have to custom the form template instead of
customising the forms.py and models.py since i want to remove not add
fields ?

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to