-
-
Notifications
You must be signed in to change notification settings - Fork 206
Added participants who have expressed interest in a specific issue in issue model . #1995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/mentorship-portal
Are you sure you want to change the base?
Changes from all commits
81a8713
1ee00ae
5fd03c7
e2b66b7
d924096
b77a27c
c617cf3
bc1d0d6
686e6c1
67290f9
0610ee8
bafd85c
a1e176c
defe5a8
5f84dcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""GitHub app Comment model admin.""" | ||
|
||
from django.contrib import admin | ||
|
||
from apps.github.models import Comment | ||
|
||
|
||
class CommentAdmin(admin.ModelAdmin): | ||
"""Admin for Comment model.""" | ||
|
||
list_display = ( | ||
"body", | ||
"author", | ||
"created_at", | ||
"updated_at", | ||
) | ||
list_filter = ("created_at", "updated_at") | ||
search_fields = ("body", "author__login") | ||
|
||
|
||
admin.site.register(Comment, CommentAdmin) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
from django.utils import timezone | ||
from github.GithubException import UnknownObjectException | ||
|
||
from apps.github.models.comment import Comment | ||
from apps.github.models.issue import Issue | ||
from apps.github.models.label import Label | ||
from apps.github.models.milestone import Milestone | ||
|
@@ -227,3 +228,116 @@ def sync_repository( | |
) | ||
|
||
return organization, repository | ||
|
||
|
||
def sync_issue_comments(gh_client, issue: Issue): | ||
"""Sync new comments for a mentorship program specific issue on-demand. | ||
|
||
Args: | ||
gh_client (Github): GitHub client. | ||
issue (Issue): The local database Issue object to sync comments for. | ||
|
||
""" | ||
logger.info("Starting comment sync for issue #%s", issue.number) | ||
|
||
try: | ||
if not (repository := issue.repository): | ||
logger.warning("Issue #%s has no repository, skipping", issue.number) | ||
return | ||
|
||
logger.info("Fetching repository: %s", repository.path) | ||
|
||
gh_repository = gh_client.get_repo(repository.path) | ||
gh_issue = gh_repository.get_issue(number=issue.number) | ||
|
||
since = issue.last_comment_sync | ||
if not since: | ||
Comment on lines
+253
to
+254
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
last_comment = issue.latest_comment | ||
since = last_comment.created_at if last_comment else None | ||
|
||
if since: | ||
logger.info("Found last comment at: %s, fetching newer comments", since) | ||
else: | ||
logger.info("No existing comments found, fetching all comments") | ||
Comment on lines
+258
to
+261
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this useful? |
||
|
||
existing_comments = {c.github_id: c for c in issue.comments.select_related("author").all()} | ||
comments_to_save = [] | ||
comments_to_update = [] | ||
current_time = timezone.now() | ||
|
||
gh_comments = gh_issue.get_comments(since=since) if since else gh_issue.get_comments() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it work with just |
||
|
||
for gh_comment in gh_comments: | ||
existing_comment = existing_comments.get(gh_comment.id) | ||
|
||
if existing_comment: | ||
Comment on lines
+271
to
+273
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if since and gh_comment.updated_at <= since: | ||
logger.info("Skipping unchanged comment %s", gh_comment.id) | ||
continue | ||
|
||
author = User.update_data(gh_comment.user) | ||
if author: | ||
Comment on lines
+278
to
+279
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
existing_comment.from_github(gh_comment, author=author) | ||
comments_to_update.append(existing_comment) | ||
logger.info( | ||
"Prepared update for comment %s on issue #%s", gh_comment.id, issue.number | ||
) | ||
else: | ||
logger.warning("Could not sync author for comment update %s", gh_comment.id) | ||
else: | ||
if since and gh_comment.created_at <= since: | ||
logger.info( | ||
"Skipping comment %s - not newer than our last sync", gh_comment.id | ||
) | ||
continue | ||
Comment on lines
+288
to
+292
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you skip comments instead of syncing it? |
||
|
||
author = User.update_data(gh_comment.user) | ||
if author: | ||
comment = Comment.update_data(gh_comment, author=author, save=False) | ||
comments_to_save.append(comment) | ||
logger.info( | ||
"Prepared new comment %s for issue #%s", gh_comment.id, issue.number | ||
) | ||
else: | ||
logger.warning("Could not sync author for comment %s", gh_comment.id) | ||
|
||
if comments_to_save: | ||
new_comment_github_ids = [c.github_id for c in comments_to_save] | ||
|
||
Comment.bulk_save(comments_to_save) | ||
|
||
newly_saved_comments = Comment.objects.filter(github_id__in=new_comment_github_ids) | ||
|
||
issue.comments.add(*newly_saved_comments) | ||
|
||
logger.info( | ||
"Synced and associated %d new comments for issue #%s", | ||
newly_saved_comments.count(), | ||
issue.number, | ||
) | ||
|
||
if comments_to_update: | ||
Comment.bulk_save(comments_to_update) | ||
logger.info( | ||
"Updated %d existing comments for issue #%s", | ||
len(comments_to_update), | ||
issue.number, | ||
) | ||
|
||
issue.last_comment_sync = current_time | ||
issue.save(update_fields=["last_comment_sync"]) | ||
|
||
if not comments_to_save and not comments_to_update: | ||
logger.info("No new or updated comments found for issue #%s", issue.number) | ||
|
||
except UnknownObjectException as e: | ||
logger.warning( | ||
"Could not access issue #%s. Error: %s", | ||
issue.number, | ||
str(e), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you need str() here? |
||
) | ||
except Exception: | ||
logger.exception( | ||
"An unexpected error occurred during comment sync for issue #%s", | ||
issue.number, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Generated by Django 5.2.4 on 2025-09-05 22:55 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("github", "0035_alter_user_bio_alter_user_is_owasp_staff"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Comment", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, primary_key=True, serialize=False, verbose_name="ID" | ||
), | ||
), | ||
("github_id", models.BigIntegerField(unique=True)), | ||
("body", models.TextField()), | ||
("created_at", models.DateTimeField(db_index=True)), | ||
("updated_at", models.DateTimeField(db_index=True)), | ||
( | ||
"author", | ||
models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="comments", | ||
to="github.user", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Comment", | ||
"verbose_name_plural": "Comments", | ||
"ordering": ("-created_at",), | ||
}, | ||
), | ||
migrations.AddField( | ||
model_name="issue", | ||
name="comments", | ||
field=models.ManyToManyField(blank=True, related_name="issues", to="github.comment"), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 5.2.4 on 2025-09-07 17:45 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("github", "0036_comment_issue_comments"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="issue", | ||
name="last_comment_sync", | ||
field=models.DateTimeField( | ||
blank=True, db_index=True, null=True, verbose_name="Last comment sync" | ||
), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
"""Github app.""" | ||
|
||
from .comment import Comment | ||
from .milestone import Milestone | ||
from .pull_request import PullRequest | ||
from .user import User |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
"""GitHub app comment model.""" | ||
|
||
from django.db import models | ||
|
||
from apps.common.models import BulkSaveModel | ||
|
||
|
||
class Comment(BulkSaveModel, models.Model): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please make it a timestamped model. |
||
"""Represents a comment on a GitHub Issue.""" | ||
|
||
class Meta: | ||
verbose_name = "Comment" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
verbose_name_plural = "Comments" | ||
ordering = ("-created_at",) | ||
|
||
github_id = models.BigIntegerField(unique=True) | ||
author = models.ForeignKey( | ||
"github.User", on_delete=models.SET_NULL, null=True, related_name="comments" | ||
) | ||
body = models.TextField() | ||
created_at = models.DateTimeField(db_index=True) | ||
updated_at = models.DateTimeField(db_index=True) | ||
|
||
def __str__(self): | ||
"""Return a string representation of the comment.""" | ||
return f"{self.author} - {self.body[:40]}" | ||
|
||
def from_github(self, gh_comment, author=None): | ||
"""Populate fields from a GitHub API comment object.""" | ||
field_mapping = { | ||
"body": "body", | ||
"created_at": "created_at", | ||
"updated_at": "updated_at", | ||
} | ||
|
||
for model_field, gh_field in field_mapping.items(): | ||
value = getattr(gh_comment, gh_field, None) | ||
if value is not None: | ||
setattr(self, model_field, value) | ||
|
||
self.author = author | ||
|
||
@staticmethod | ||
def bulk_save(comments, fields=None): # type: ignore[override] | ||
"""Bulk save comments.""" | ||
BulkSaveModel.bulk_save(Comment, comments, fields=fields) | ||
|
||
@staticmethod | ||
def update_data(gh_comment, *, author=None, save: bool = True): | ||
"""Update or create a Comment instance from a GitHub comment object. | ||
|
||
Args: | ||
gh_comment (github.IssueComment.IssueComment): GitHub comment object. | ||
author (User, optional): Comment author. Defaults to None. | ||
save (bool, optional): Whether to save the instance immediately. Defaults to True. | ||
|
||
Returns: | ||
Comment: The updated or newly created Comment instance. | ||
|
||
""" | ||
try: | ||
comment = Comment.objects.get(github_id=gh_comment.id) | ||
except Comment.DoesNotExist: | ||
comment = Comment(github_id=gh_comment.id) | ||
|
||
comment.from_github(gh_comment, author=author) | ||
|
||
if save: | ||
comment.save() | ||
|
||
return comment | ||
Rajgupta36 marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -44,6 +44,9 @@ class Meta: | |||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
comments_count = models.PositiveIntegerField(verbose_name="Comments", default=0) | ||||||||||||||||||||||||||||||||||||||||||
last_comment_sync = models.DateTimeField( | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can't we use latest comment date instead? |
||||||||||||||||||||||||||||||||||||||||||
verbose_name="Last comment sync", blank=True, null=True, db_index=True | ||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
# FKs. | ||||||||||||||||||||||||||||||||||||||||||
author = models.ForeignKey( | ||||||||||||||||||||||||||||||||||||||||||
|
@@ -54,6 +57,13 @@ class Meta: | |||||||||||||||||||||||||||||||||||||||||
null=True, | ||||||||||||||||||||||||||||||||||||||||||
related_name="created_issues", | ||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
comments = models.ManyToManyField( | ||||||||||||||||||||||||||||||||||||||||||
"github.Comment", | ||||||||||||||||||||||||||||||||||||||||||
related_name="issues", | ||||||||||||||||||||||||||||||||||||||||||
blank=True, | ||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+61
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainPrefer FK (or GFK) over M2M for Issue ↔ Comment; current schema allows invalid many-to-many linkage A GitHub issue comment belongs to exactly one issue. Using a ManyToMany here (Issue.comments) permits linking a single comment to multiple issues, which does not match GitHub’s data model and can lead to integrity problems and more expensive queries. Recommend refactoring to either:
Minimal diff for this file if adopting Option A (the reverse manager still appears as issue.comments): - comments = models.ManyToManyField(
- "github.Comment",
- related_name="issues",
- blank=True,
- ) Run to find usages that rely on M2M semantics and would need adjustments: 🏁 Script executed: #!/bin/bash
rg -n -C2 -g '!**/migrations/**' -e '\bcomments\.add\(' -e '\bcomments\.set\(' -e '\bcomments\.remove\(' Length of output: 453 Refactor Issue ↔ Comment to a one-to-many relationship A GitHub issue comment belongs to exactly one issue, so the current ManyToManyField allows invalid linkages and carries unnecessary join-table overhead. To align the schema with GitHub’s data model and simplify queries, please migrate to a ForeignKey on Comment (Option A below). • Remove the M2M on Issue: - # backend/apps/github/models/issue.py
- comments = models.ManyToManyField(
- "github.Comment",
- related_name="issues",
- blank=True,
- ) • Add a one-to-many FK on Comment: + # backend/apps/github/models/comment.py
+ issue = models.ForeignKey(
+ "github.Issue",
+ related_name="comments",
+ on_delete=models.CASCADE,
+ ) • Migrations: Option B (GFK) is only needed if Comments must also attach to other content types (e.g. PRs). Please implement Option A to enforce data integrity and simplify the model. 📝 Committable suggestion
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment makes sense. The DB modeling here is not the best. Let's use
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain@arkid15r Great suggestion! Using Comment Model Changes ( from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
class Comment(BulkSaveModel, models.Model):
# ... existing fields ...
# Replace any existing issue-specific relationship with generic ones
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
# ... rest of the model ... Issue Model Changes ( from django.contrib.contenttypes.fields import GenericRelation
class Issue(GenericIssueModel):
# ... existing fields ...
# Replace the current M2M with GenericRelation
comments = GenericRelation(
"github.Comment",
related_query_name="issue"
)
# ... rest of the model ... Migration Considerations:
Future PullRequest Model (when implemented): class PullRequest(models.Model):
# ... fields ...
comments = GenericRelation(
"github.Comment",
related_query_name="pull_request"
) The existing Would you like me to help create the migration files for this refactor? 🏁 Script executed:
Length of output: 2280 🏁 Script executed:
Length of output: 148 🏁 Script executed:
Length of output: 148 🏁 Script executed:
Length of output: 0 Perfect! Now I have the complete picture. Based on the current Comment model structure and usage patterns, here's the updated implementation guidance: @arkid15r Here's the concrete implementation for the Comment Model Changes ( """GitHub app comment model."""
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from apps.common.models import BulkSaveModel
class Comment(BulkSaveModel, models.Model):
"""Represents a comment on a GitHub Issue or Pull Request."""
class Meta:
verbose_name = "Comment"
verbose_name_plural = "Comments"
ordering = ("-created_at",)
github_id = models.BigIntegerField(unique=True)
author = models.ForeignKey(
"github.User", on_delete=models.SET_NULL, null=True, related_name="comments"
)
body = models.TextField()
created_at = models.DateTimeField(db_index=True)
updated_at = models.DateTimeField(db_index=True)
# Generic foreign key fields
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
def __str__(self):
"""Return a string representation of the comment."""
return f"{self.author} - {self.body[:40]}"
def from_github(self, gh_comment, author=None):
"""Populate fields from a GitHub API comment object."""
field_mapping = {
"body": "body",
"created_at": "created_at",
"updated_at": "updated_at",
}
for model_field, gh_field in field_mapping.items():
value = getattr(gh_comment, gh_field, None)
if value is not None:
setattr(self, model_field, value)
self.author = author
@staticmethod
def bulk_save(comments, fields=None):
"""Bulk save comments."""
BulkSaveModel.bulk_save(Comment, comments, fields=fields)
@staticmethod
def update_data(gh_comment, *, author=None, save: bool = True):
"""Update or create a Comment instance from a GitHub comment object."""
try:
comment = Comment.objects.get(github_id=gh_comment.id)
except Comment.DoesNotExist:
comment = Comment(github_id=gh_comment.id)
comment.from_github(gh_comment, author=author)
if save:
comment.save()
return comment Issue Model Changes ( # Add this import at the top
from django.contrib.contenttypes.fields import GenericRelation
# Replace the current ManyToManyField with:
comments = GenericRelation(
"github.Comment",
related_query_name="issue"
)
# Also update the latest_comment property to work with GenericRelation:
@property
def latest_comment(self):
"""Get the latest comment for this issue."""
return self.comments.order_by("-created_at").first() Migration Strategy:
The existing usage in This approach provides the flexibility for future PR comments while maintaining clean, efficient queries and proper data integrity. 🏁 Script executed:
Length of output: 840 🏁 Script executed:
Length of output: 404 🏁 Script executed:
Length of output: 507 🏁 Script executed:
Length of output: 3879 Perfect! Now I can see all the usage patterns. The good news is that all existing code will work unchanged with @arkid15r Based on the usage analysis, here's the complete implementation that will maintain backward compatibility: Files to Change1. Comment Model ( """GitHub app comment model."""
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from apps.common.models import BulkSaveModel
class Comment(BulkSaveModel, models.Model):
"""Represents a comment on a GitHub Issue or Pull Request."""
class Meta:
verbose_name = "Comment"
verbose_name_plural = "Comments"
ordering = ("-created_at",)
github_id = models.BigIntegerField(unique=True)
author = models.ForeignKey(
"github.User", on_delete=models.SET_NULL, null=True, related_name="comments"
)
body = models.TextField()
created_at = models.DateTimeField(db_index=True)
updated_at = models.DateTimeField(db_index=True)
# Generic foreign key to support both Issues and future PRs
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
# Rest of the methods remain unchanged... 2. Issue Model ( # Add this import at the top:
from django.contrib.contenttypes.fields import GenericRelation
# Replace the current ManyToManyField with:
comments = GenericRelation(
"github.Comment",
related_query_name="issue"
)
# The latest_comment property remains the same - it will work unchanged Migration StrategySchema Migration: # New migration file
operations = [
# Add GenericForeignKey fields to Comment
migrations.AddField(
model_name='comment',
name='content_type',
field=models.ForeignKey('contenttypes.ContentType', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='comment',
name='object_id',
field=models.PositiveIntegerField(),
),
# Remove the M2M relationship
migrations.RemoveField(
model_name='issue',
name='comments',
),
] Data Migration: # Separate data migration to populate the new fields
def migrate_comment_relationships(apps, schema_editor):
Comment = apps.get_model('github', 'Comment')
Issue = apps.get_model('github', 'Issue')
ContentType = apps.get_model('contenttypes', 'ContentType')
issue_content_type = ContentType.objects.get_for_model(Issue)
# Get the M2M through table and populate GenericFK fields
# This requires accessing the M2M through table before it's dropped Compatibility VerificationAll existing usage patterns will work unchanged: ✅ Line 263: The refactor maintains full API compatibility while enabling future PR comment support. No changes needed in ✏️ Learnings added
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
milestone = models.ForeignKey( | ||||||||||||||||||||||||||||||||||||||||||
"github.Milestone", | ||||||||||||||||||||||||||||||||||||||||||
on_delete=models.CASCADE, | ||||||||||||||||||||||||||||||||||||||||||
|
@@ -83,6 +93,16 @@ class Meta: | |||||||||||||||||||||||||||||||||||||||||
blank=True, | ||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
@property | ||||||||||||||||||||||||||||||||||||||||||
def latest_comment(self): | ||||||||||||||||||||||||||||||||||||||||||
"""Get the latest comment for this issue. | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
Returns: | ||||||||||||||||||||||||||||||||||||||||||
Comment | None: The most recently created comment, or None if no comments exist. | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||
return self.comments.order_by("-created_at").first() | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
def from_github(self, gh_issue, *, author=None, milestone=None, repository=None): | ||||||||||||||||||||||||||||||||||||||||||
"""Update the instance based on GitHub issue data. | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mentorship-update-comments: | ||
@echo "Syncing Github Comments related to issues" | ||
@CMD="python manage.py mentorship_update_comments --verbosity 2" $(MAKE) exec-backend-command |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"""Mentorship app IssueUserInterest admin.""" | ||
|
||
from django.contrib import admin | ||
|
||
from apps.mentorship.models import IssueUserInterest | ||
|
||
|
||
class IssueUserInterestAdmin(admin.ModelAdmin): | ||
"""IssueUserInterest admin.""" | ||
|
||
list_display = ("module", "issue") | ||
search_fields = ("module__name", "user__login", "issue__title") | ||
list_filter = ("module",) | ||
|
||
|
||
admin.site.register(IssueUserInterest, IssueUserInterestAdmin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is inconsistent. Either use type hint for both or don't use it at all.