diff --git a/djangoproject/core/models.py b/djangoproject/core/models.py index 37b9792f..65d19bf1 100644 --- a/djangoproject/core/models.py +++ b/djangoproject/core/models.py @@ -298,15 +298,18 @@ def get_image3x1(self): def get_tags(self): return Tag.objects.filter(objtype="Project", objid=self.id) - def to_json(self): - return json.dumps({ + def to_dict_json(self): + return { 'id': self.id, 'name': self.name, 'description': self.description, 'homeURL': self.homeURL, 'trackerURL': self.trackerURL, 'image3x1': self.image3x1.url if self.image3x1 else None, - }) + } + + def to_json(self): + return json.dumps(self.to_dict_json()) def __unicode__(self): return self.name @@ -385,12 +388,16 @@ def changeIssue(self, issuedict): self.title = issuedict.get('title') self.touch() - def to_json(self): - return json.dumps({ + def to_dict_json(self): + return { 'id': self.id, 'title': self.title, - 'description': self.description - }) + 'description': self.description, + 'link': self.get_view_link(), + } + + def to_json(self): + return json.dumps(self.to_dict_json()) def getTotalOffersPriceUSD(self): return self.getTotalOffersPrice_by_currency('USD') @@ -567,8 +574,8 @@ class Offer(models.Model): REVOKED = "REVOKED" PAID = "PAID" - def to_json(self): - return json.dumps({ + def to_dict_json(self): + return { 'id': self.id, 'price': float(str(self.price)), 'currency': self.currency, @@ -576,7 +583,10 @@ def to_json(self): 'no_forking': self.no_forking, 'require_release': self.require_release, 'status': self.status, - }) + } + + def to_json(self): + return json.dumps(self.to_dict_json()) @classmethod def newOffer(cls, issue, sponsor, price, currency, acceptanceCriteria, no_forking, require_release, expiration_days): @@ -915,11 +925,13 @@ class PaymentPart(models.Model): solution = models.ForeignKey(Solution) paypalEmail = models.EmailField(max_length=256, null=True) price = models.DecimalField(max_digits=16, decimal_places=8) - money_sent = models.ForeignKey(MoneySent, null = True) + money_sent = models.ForeignKey(MoneySent, null=True) def to_dict_json(self): return { 'programmer_id': self.programmer.id, + 'programmer_image': self.programmer.gravatar_url_small(), + 'programmer_screenname': self.programmer.getUserInfo().screenname, 'solution_id': self.solution.id, 'price': float(str(self.price)) if self.price else None, } @@ -970,10 +982,15 @@ def to_dict_json(self): 'action': self.action, 'entity': self.entity, # 'creationDate': self.id, + 'user_image': self.user.gravatar_url_medium(), + 'user_screenname': self.user.getUserInfo().screenName, 'user_id': self.user.id, 'project_id': self.project.id if self.project else None, + 'project': self.project.to_dict_json() if self.project else None, 'issue_id': self.issue.id if self.issue else None, + 'issue': self.issue.to_dict_json() if self.issue else None, 'offer_id': self.offer.id if self.offer else None, + 'offer': self.offer.to_dict_json() if self.offer else None, 'solution_id': self.solution.id if self.solution else None, 'issue_comment_id': self.issue_comment.id if self.issue_comment else None, 'old_json': self.old_json, diff --git a/djangoproject/core/services/activity_services.py b/djangoproject/core/services/activity_services.py index 24515ce8..a5c37108 100644 --- a/djangoproject/core/services/activity_services.py +++ b/djangoproject/core/services/activity_services.py @@ -1,4 +1,5 @@ from core.models import ActionLog +from django.db.models import Q __author__ = 'tony' @@ -6,6 +7,6 @@ def get_latest_activity(project_id): query = ActionLog.objects.all() if project_id: - query = query.filter(project__id=project_id) + query = query.filter(Q(project__id=project_id) & (~Q(action__in=['ADD_ISSUE_COMMENT', 'EDIT_ISSUE_COMMENT']))) query = query.order_by('-creationDate') return query[0:10] diff --git a/djangoproject/statfiles/static/js/activitylist/activitylist.html b/djangoproject/statfiles/static/js/activitylist/activitylist.html index 93b865eb..8e5ceaa8 100644 --- a/djangoproject/statfiles/static/js/activitylist/activitylist.html +++ b/djangoproject/statfiles/static/js/activitylist/activitylist.html @@ -1,5 +1,76 @@