Returns the dict of data to be used to create a comment. Subclasses in
        custom comment apps that override get_comment_model can override this
        method to add extra fields onto a custom comment model.
173213
def get_comment_create_data(self):
        
        user_model = get_user_model()
        return dict(
            content_type=ContentType.objects.get_for_model(self.target_object),
            object_pk=force_text(self.target_object._get_pk_val()),
            text=self.cleaned_data["text"],
            user=user_model.objects.latest('id'),
            post_date=timezone.now(),
            site_id=settings.SITE_ID,
            is_public=True,
            is_removed=False,
        )
238117
def get_comments(self):
        
        bug = str(self._bug['id'])
        res = self._bugsy.request('bug/%s/comment' % bug)

        return [Comment(bugsy=self._bugsy, **comments) for comments
                in res['bugs'][bug]['comments']]
755279
def get_comment(self, item):
        
        key = item.upper()
        if key not in self._record_map:
            raise KeyError("unknown record: %s" % key)

        if 'comment' not in self._record_map[key]:
            return None
        else:
            return self._record_map[key]['comment']
376930
def get_messages(self):
        
        cs = self.data["comments"]["data"]
        res = [] 
        for c in cs:
            res.append(Message(c,self))
        return res
1348538
def _get_model_fields(self, field_names, declared_fields, extra_kwargs):
        
        model = getattr(self.Meta, 'model')
        model_fields = {}

        for field_name in field_names:
            if field_name in declared_fields:
                # If the field is declared on the serializer
                field = declared_fields[field_name]
                source = field.source or field_name
            else:
                try:
                    source = extra_kwargs[field_name]['source']
                except KeyError:
                    source = field_name

            if '.' in source or source == '*':
                # Model fields will always have a simple source mapping,
                # they can't be nested attribute lookups.
                continue

            try:
                field = model._meta.get_field(source)
                if isinstance(field, DjangoModelField):
                    model_fields[source] = field
            except FieldDoesNotExist:
                pass

        return model_fields
707246
def make_extra_json_fields(args):
    
    extra_json_fields = {
        'data_group': _get_data_group(args.query),
        'data_type': _get_data_type(args.query),
        'data_group_data_type': _get_data_group_data_type(args.query),
        'query': _get_query_params(args.query),
    }
    if "path_to_json_file" in args.query:
        extra_json_fields['path_to_query'] = _get_path_to_json_file(args.query)
    return extra_json_fields
644679
def comment_count(obj):
    
    model_object = type(obj).objects.get(id=obj.id)
    return model_object.comments.all().count()
489937
def CopyToDict(self):
    
    result_dict = {
        'labels': self.labels
    }
    if self.comment:
      result_dict['comment'] = self.comment

    return result_dict
843554
def itemComments(self):
        
        url = "%s/comments/" % self.root
        params = {
            "f": "json"
        }
        return self._get(url,
                            params,
                            securityHandler=self._securityHandler,
                            proxy_port=self._proxy_port,
                            proxy_url=self._proxy_url)
16728
def get_custom_fields(self):
        
        return CustomField.objects.filter(
            content_type=ContentType.objects.get_for_model(self))
334471
def comments(self, issue):
        
        r_json = self._get_json('issue/' + str(issue) + '/comment')

        comments = [Comment(self._options, self._session, raw_comment_json)
                    for raw_comment_json in r_json['comments']]
        return comments
1123776
def to_dict(self):
        ''''''
        d = {'name': self.name}
        if self.visible != True:
            d[RTS_EXT_NS_YAML + 'visible'] = self.visible
        if self.comment:
            d[RTS_EXT_NS_YAML + 'comment'] = self.comment
        props = []
        for name in self.properties:
            p = {'name': name}
            if self.properties[name]:
                p['value'] = str(self.properties[name])
            props.append(p)
        if props:
            d[RTS_EXT_NS_YAML + 'properties'] = props
        return d
310670
def create(self, comment, mentions=()):
        

        data = {
            "app": self.app_id,
            "record": self.record_id,
            "comment": {
                "text": comment,
            }
        }

        if len(mentions) > 0:
            _mentions = []
            for m in mentions:
                if isinstance(m, (list, tuple)):
                    if len(m) == 2:
                        _mentions.append({
                            "code": m[0],
                            "type": m[1]
                        })
                    else:
                        raise Exception("mention have to have code and target type. ex.[('user_1', 'USER')]")
                elif isinstance(m, Mention):
                    _mentions.append(m.serialize())

            data["comment"]["mentions"] = _mentions

        resp = self._request("POST", self._url, data)
        r = cr.CreateCommentResult(resp)
        return r
108516
def comment(request, template="generic/comments.html", extra_context=None):
    
    response = initial_validation(request, "comment")
    if isinstance(response, HttpResponse):
        return response
    obj, post_data = response
    form_class = import_dotted_path(settings.COMMENT_FORM_CLASS)
    form = form_class(request, obj, post_data)
    if form.is_valid():
        url = obj.get_absolute_url()
        if is_spam(request, form, url):
            return redirect(url)
        comment = form.save(request)
        response = redirect(add_cache_bypass(comment.get_absolute_url()))
        # Store commenter's details in a cookie for 90 days.
        for field in ThreadedCommentForm.cookie_fields:
            cookie_name = ThreadedCommentForm.cookie_prefix + field
            cookie_value = post_data.get(field, "")
            set_cookie(response, cookie_name, cookie_value)
        return response
    elif request.is_ajax() and form.errors:
        return HttpResponse(dumps({"errors": form.errors}))
    # Show errors with stand-alone comment form.
    context = {"obj": obj, "posted_comment_form": form}
    context.update(extra_context or {})
    return TemplateResponse(request, template, context)
33597
def obtain_comments_form

    	if Setting.get('article_comments') == 'Y'
        type = Setting.get('article_comment_type')
        @new_comment = Comment.new
        if File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/comments_form." + get_theme_ext)
          render(:template => "themes/#{current_theme}/comments_form." + get_theme_ext , :layout => nil, :locals => { type: type }).to_s
        else
          render :inline => 'comments_form.html.erb does not exist in current theme'
        end
      end

    end
667273
def comment_form(context, object):
    
    user = context.get("user")
    form_class = context.get("form", CommentForm)
    form = form_class(obj=object, user=user)
    return form
767554
def get_comments(self):
        
        return github.PaginatedList.PaginatedList(
            github.CommitComment.CommitComment,
            self._requester,
            self.url + "/comments",
            None
        )