-
Notifications
You must be signed in to change notification settings - Fork 16
Add github_username to CustomUser for stats tracking (#615) #618
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
Open
Moueen-Togarvi
wants to merge
2
commits into
djangonaut-space:develop
Choose a base branch
from
Moueen-Togarvi:djangonaut-stats
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Generated by Django 5.2.7 on 2025-12-09 17:59 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("accounts", "0009_useravailability"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="customuser", | ||
| name="github_username", | ||
| field=models.CharField( | ||
| blank=True, | ||
| help_text="GitHub username (without @)", | ||
| max_length=39, | ||
| null=True, | ||
| ), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,7 @@ class SessionMembershipAdmin(admin.ModelAdmin): | |
| @admin.register(Session) | ||
| class SessionAdmin(admin.ModelAdmin): | ||
| inlines = [SessionMembershipInline] | ||
| actions = ["form_teams_action"] | ||
| actions = ["form_teams_action", "collect_djangonaut_stats_action"] | ||
|
|
||
| def get_urls(self): | ||
| """Add custom URLs for team formation""" | ||
|
|
@@ -71,9 +71,20 @@ def get_urls(self): | |
| self.admin_site.admin_view(calculate_overlap_ajax), | ||
| name="session_calculate_overlap", | ||
| ), | ||
| path( | ||
| "<int:session_id>/collect-stats/", | ||
| self.admin_site.admin_view(self.collect_stats_view), | ||
| name="session_collect_stats", | ||
| ), | ||
| ] | ||
| return custom_urls + urls | ||
|
|
||
| def collect_stats_view(self, request, session_id): | ||
| """Handle GitHub stats collection for a session.""" | ||
| from .views.sessions import collect_stats_view | ||
|
|
||
| return collect_stats_view(request, session_id) | ||
|
Comment on lines
+82
to
+86
Member
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. I think having this as an actual link rather than an action is probably best. I just introduced this in #619 |
||
|
|
||
| @admin.action(description="Form teams for this session") | ||
| def form_teams_action(self, request, queryset): | ||
| """Redirect to team formation interface for selected session""" | ||
|
|
@@ -89,6 +100,21 @@ def form_teams_action(self, request, queryset): | |
| url = reverse("admin:session_form_teams", args=[session.id]) | ||
| return redirect(url) | ||
|
|
||
| @admin.action(description="Collect Djangonaut GitHub stats") | ||
| def collect_djangonaut_stats_action(self, request, queryset): | ||
| """Redirect to GitHub stats collection view for selected session""" | ||
| if queryset.count() != 1: | ||
| self.message_user( | ||
| request, | ||
| "Please select exactly one session to collect stats.", | ||
| messages.ERROR, | ||
| ) | ||
| return | ||
|
|
||
| session = queryset.first() | ||
| url = reverse("admin:session_collect_stats", args=[session.id]) | ||
| return redirect(url) | ||
|
|
||
|
|
||
| @admin.register(Team) | ||
| class TeamAdmin(admin.ModelAdmin): | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Management commands package.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Services package for home app.""" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please be aware we've added this field to the
UserProfilemodel already.