-
Notifications
You must be signed in to change notification settings - Fork 34
Shift selling rebased version of #882 #1880
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
Draft
zarya
wants to merge
18
commits into
main
Choose a base branch
from
shift-selling
base: main
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.
Draft
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
005431d
team shifts: implement marking shifts for sale
reynir c78c625
Fixed conflicts
zarya 92ce3e6
Merge branch 'main' into shift-selling
zarya c81dfca
Cleaned up and made it work, including the migration marigoround
zarya 43b80bb
Some more fixes, changed the wording in the button
zarya 7394502
Merge branch 'main' into shift-selling
zarya 54ce6fc
Change the shift actions from get to post with a confirm
zarya 076f605
Add Cancel button
zarya ea68b09
Merge branch 'main' into shift-selling
zarya ef56aaf
Update src/teams/models.py
tykling 56015c2
Update src/teams/models.py
tykling 506b988
Fix property naming
zarya 6812b26
Update src/teams/views/shifts.py
tykling ce8985b
Add updated_at and sort so oldest is picked first
zarya 94a0c57
Merge branch 'main' into shift-selling
zarya 096a5d4
Merge branch 'main' into shift-selling
tykling 3cc4e7e
Add ensure team member mixin to all shift actions
zarya a068b2b
Improve tests to test for 403's
zarya 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
33 changes: 33 additions & 0 deletions
33
src/teams/migrations/0064_teamshiftassignment_teamshift_team_members_new.py
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,33 @@ | ||
| # Generated by Django 4.2.21 on 2025-06-09 15:29 | ||
|
|
||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('teams', '0063_alter_team_member_group'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='TeamShiftAssignment', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('created', models.DateTimeField(auto_now_add=True)), | ||
| ('updated', models.DateTimeField(auto_now=True)), | ||
| ('for_sale', models.BooleanField(default=False, help_text='Is the shift assignment for sale?')), | ||
| ('team_member', models.ForeignKey(help_text='The team member on shift', on_delete=django.db.models.deletion.CASCADE, to='teams.teammember')), | ||
| ('team_shift', models.ForeignKey(help_text='The shift', on_delete=django.db.models.deletion.CASCADE, to='teams.teamshift')), | ||
| ], | ||
| options={ | ||
| 'abstract': False, | ||
| }, | ||
| ), | ||
| migrations.AddField( | ||
| model_name='teamshift', | ||
| name='team_members_new', | ||
| field=models.ManyToManyField(blank=True, related_name='team_members_new', through='teams.TeamShiftAssignment', to='teams.teammember'), | ||
| ), | ||
| ] |
19 changes: 19 additions & 0 deletions
19
src/teams/migrations/0065_teamshiftassignment_migrate_data.py
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,19 @@ | ||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
|
|
||
| def migrate_assignments(apps, schema_editor): | ||
| TeamShift = apps.get_model("teams", "TeamShift") | ||
| for teamshift in TeamShift.objects.all(): | ||
| members = teamshift.team_members.all() | ||
| teamshift.team_members_new.set(members) | ||
| teamshift.save() | ||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('teams', '0064_teamshiftassignment_teamshift_team_members_new'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RunPython(migrate_assignments), | ||
| ] |
17 changes: 17 additions & 0 deletions
17
src/teams/migrations/0066_remove_teamshift_team_members.py
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,17 @@ | ||
| # Generated by Django 4.2.21 on 2025-06-09 15:37 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('teams', '0065_teamshiftassignment_migrate_data'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RemoveField( | ||
| model_name='teamshift', | ||
| name='team_members', | ||
| ), | ||
| ] |
18 changes: 18 additions & 0 deletions
18
src/teams/migrations/0067_rename_team_members_new_teamshift_team_members.py
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,18 @@ | ||
| # Generated by Django 4.2.21 on 2025-06-09 15:38 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('teams', '0066_remove_teamshift_team_members'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RenameField( | ||
| model_name='teamshift', | ||
| old_name='team_members_new', | ||
| new_name='team_members', | ||
| ), | ||
| ] |
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,18 @@ | ||
| # Generated by Django 4.2.21 on 2025-06-09 15:38 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('teams', '0067_rename_team_members_new_teamshift_team_members'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name='teamshift', | ||
| name='team_members', | ||
| field=models.ManyToManyField(blank=True, through='teams.TeamShiftAssignment', to='teams.teammember'), | ||
| ), | ||
| ] |
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,15 @@ | ||
| {% extends 'team_base.html' %} | ||
|
|
||
| {% block title %} | ||
| {{ action }} | {{ block.super }} | ||
| {% endblock %} | ||
|
|
||
| {% block team_content %} | ||
|
|
||
| <form method="post">{% csrf_token %} | ||
| <p>{{ action }}</p> | ||
| <input type="submit" class="btn btn-danger" name="confirm" value="Confirm" /> | ||
| <a class="btn btn-secondary" href="{% url 'teams:shifts' camp_slug=camp.slug team_slug=team.slug%}"><i class="fas fa-undo"></i> Cancel</a> | ||
| </form> | ||
|
|
||
| {% endblock %} |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.