-
Notifications
You must be signed in to change notification settings - Fork 2.7k
17170 Add ability to add contacts to multiple contact groups #18885
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ea03358
17170 Allow multiple Group assignments for Contacts
arthanson 771a9a2
17170 update docs
arthanson c7827c7
17170 update api, detail view, graphql
arthanson e1f8ff1
17170 fixes
arthanson c7cb869
17170 fixes
arthanson 31dd765
17170 fixes
arthanson 8c62465
17170 fixes
arthanson a843765
17170 fixes
arthanson 1b2c96b
17170 fixes
arthanson 5782ad8
17170 fix bulk import
arthanson e331be3
17170 test fixes
arthanson 82233c1
17170 test fixes
arthanson 9436ab6
17170 test fixes
arthanson 51f9f4c
Merge branch 'feature' into 17170-contact-groups
arthanson bf1e33f
17178 review changes
arthanson a4eb86f
17178 review changes
arthanson 83793de
17178 review changes
arthanson 78e0a5a
17178 review changes
arthanson 5a5a7f3
17178 review changes
arthanson 8ff35c0
17178 review changes
arthanson 9b13674
17170 update migration
arthanson 9005e8a
17170 bulk edit form
arthanson 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
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
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,94 @@ | ||
# Generated by Django 5.1.5 on 2025-03-11 20:27 | ||
|
||
arthanson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
def migrate_contact_groups(apps, schema_editor): | ||
Contacts = apps.get_model('tenancy', 'Contact') | ||
|
||
qs = Contacts.objects.filter(group__isnull=False) | ||
for contact in qs: | ||
contact.groups.add(contact.group) | ||
contact.save() | ||
arthanson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('tenancy', '0017_natural_ordering'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ContactGroupMembership', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), | ||
], | ||
), | ||
migrations.RemoveConstraint( | ||
model_name='contact', | ||
name='tenancy_contact_unique_group_name', | ||
), | ||
migrations.AddField( | ||
model_name='contactgroupmembership', | ||
name='contact', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.contact'), | ||
), | ||
migrations.AddField( | ||
model_name='contactgroupmembership', | ||
name='group', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tenancy.contactgroup'), | ||
), | ||
migrations.AddField( | ||
model_name='contact', | ||
name='groups', | ||
field=models.ManyToManyField( | ||
blank=True, | ||
related_name='group_contacts', | ||
through='tenancy.ContactGroupMembership', | ||
to='tenancy.contactgroup' | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name='contactgroupmembership', | ||
constraint=models.UniqueConstraint(fields=('group', 'contact'), name='unique_group_name'), | ||
), | ||
migrations.RunPython(code=migrate_contact_groups, reverse_code=migrations.RunPython.noop), | ||
migrations.RemoveField( | ||
model_name='contact', | ||
name='group', | ||
), | ||
migrations.AlterField( | ||
model_name='contact', | ||
name='groups', | ||
field=models.ManyToManyField( | ||
blank=True, related_name='contacts', through='tenancy.ContactGroupMembership', to='tenancy.contactgroup' | ||
), | ||
), | ||
arthanson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
migrations.AlterField( | ||
model_name='contactgroupmembership', | ||
name='contact', | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, related_name='+', to='tenancy.contact' | ||
), | ||
), | ||
arthanson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
migrations.AlterField( | ||
model_name='contactgroupmembership', | ||
name='group', | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, related_name='+', to='tenancy.contactgroup' | ||
), | ||
), | ||
arthanson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
migrations.AlterField( | ||
model_name='contact', | ||
name='groups', | ||
field=models.ManyToManyField( | ||
blank=True, | ||
related_name='contacts', | ||
related_query_name='contact', | ||
through='tenancy.ContactGroupMembership', | ||
to='tenancy.contactgroup', | ||
), | ||
), | ||
arthanson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] |
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.