tcms.core.helpers.comments module

Functions that help access comments of objects.

tcms.core.helpers.comments.add_comment(objs, comments, user, submit_date=None)[source]

Add django.comment for an object.

Parameters:
  • objs (list) – List of object to which to add comments

  • comments (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.Comment objects representing the newly created comments

Return type:

list

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)
comments = 'stupid comments by Homer'
add_comment([testrun,], comments, testuser)
tcms.core.helpers.comments.get_comments(obj)[source]