tcms.core.helpers.comments module¶
Functions that help access comments of objects.
- tcms.core.helpers.comments.add_comment(objs, comment_text, user, submit_date=None)[source]¶
Add django.comment for an object.
- Parameters:
objs (list) – List of object to which to add comments
comment_text (str) – The commentary
user (A User model) – Who is adding this
submit_date (datetime.datetime) – A time stamp
- Returns:
A list of
django_comments.models.Commentobjects representing the newly created comments- Return type:
Example:
from django.contrib.auth.models import User testuser = User.objects.get(email='user@example.com') from tcms.testruns.models import TestExecution testrun = TestExecution.objects.get(pk=171675) comment_text = 'stupid comments by Homer' add_comment([testrun,], comment_text, testuser)