-
Notifications
You must be signed in to change notification settings - Fork 8
Program tags #247
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
Program tags #247
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
69850b7
Add tags to block diagrams
cabarnes 055bdc4
Add filtering on tags
cabarnes f1d3e46
Restrict tag name length
cabarnes 2588025
Make tag names unique in the database
cabarnes 66f722e
Merge branch 'alpha' into program-tags
cabarnes ba9db61
Add filtering by 'admin_tags' and 'owner_tags'
cabarnes 9c75650
Merge branch 'alpha' into program-tags
cabarnes 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,33 @@ | ||
| # Generated by Django 2.2.3 on 2019-08-11 15:50 | ||
|
|
||
| import django.contrib.postgres.fields.citext | ||
| from django.contrib.postgres.operations import CITextExtension | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('mission_control', '0016_auto_20190801_0117'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| CITextExtension(), | ||
| migrations.CreateModel( | ||
| name='Tag', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('name', django.contrib.postgres.fields.citext.CICharField(max_length=30)), | ||
| ], | ||
| ), | ||
| migrations.AddField( | ||
| model_name='blockdiagram', | ||
| name='admin_tags', | ||
| field=models.ManyToManyField(blank=True, related_name='admin_block_diagrams', to='mission_control.Tag'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='blockdiagram', | ||
| name='owner_tags', | ||
| field=models.ManyToManyField(blank=True, related_name='owner_block_diagrams', to='mission_control.Tag'), | ||
| ), | ||
| ] |
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 @@ | ||
| # Generated by Django 2.2.4 on 2019-08-11 20:04 | ||
|
|
||
| import django.contrib.postgres.fields.citext | ||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('mission_control', '0017_auto_20190811_1550'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name='tag', | ||
| name='name', | ||
| field=django.contrib.postgres.fields.citext.CICharField(max_length=30, unique=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
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.
So there is a derived property
tagsthat is the combination ofowner_tagsandadmin_tags, and that's what the query filter searches. Is that right?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.
It can't use the property since that's not available for the database query. But, it does something similar in this method:
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.
Ah, I see.
I like that, because it would allow me the admin to go set the "lesson 1" admin)tag on a program if the user does not set it as a owner_tag, and user searches will return it.
But, one use case I was thinking of was a section on the landing page for "Featured Programs". I imagined it being populated by querying for admin_tag="featured program". For that, we'd need to be able to query by admin_tag alone, right? Otherwise, a user could set an owner tag of "featured program" and put their program in the section on the landing page.
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.
Yes, for that feature, we'll need to add
admin_tagsto theBlockDiagramFilter. I'll go ahead and make that change. I can make a filter onowner_tagsas well if we think that might be a use case in the future as wellThere 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.
Yeah, probably can't hurt to have every option?