-
Notifications
You must be signed in to change notification settings - Fork 6
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
[8664] auto searchprofile names #5928
Conversation
068fb43
to
f94581a
Compare
acbcec1
to
525513c
Compare
28f9ee4
to
9b13c2d
Compare
9b13c2d
to
57acdbf
Compare
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.
suggest to move the indexing in the save method.
meinberlin/apps/kiezradar/migrations/0005_alter_searchprofile_number_and_more.py
Outdated
Show resolved
Hide resolved
57acdbf
to
9d37783
Compare
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.
Left few comments, and I think we shouldn't let the name optional, but save it with the auto-generated function.
meinberlin/apps/kiezradar/models.py
Outdated
pass | ||
self.number = latest.number + 1 if latest else 1 | ||
if update_fields: | ||
update_fields.append("number") |
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.
update_fields is not a list, it needs a union
IIRC. However, I would think number field shouldn't be part of updates, only saved upon creation.
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.
good catch, I'll remove it
meinberlin/apps/kiezradar/migrations/0007_alter_searchprofile_number_and_more.py
Show resolved
Hide resolved
ordering = ["number"] | ||
constraints = [ | ||
models.UniqueConstraint("user", "number", name="unique-search-profile") | ||
] |
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.
we also need an index on the number field.
@goapunk looking at the story again, it asks that we always increase the index, even it existing profiles are deleted. But I cannot think of a simple way to do so, hence you may want to communicate this decision in the story for when the testing phase starts, they are aware. |
will do, its already in the comments of the story as well |
…reasing number per user
9d37783
to
3edb32e
Compare
As Janek has confirmed we'll use this implementation for the naming, I'll wait for this PR to be merged and check all is working in my [#8661] Add 'Save Profile' button PR. |
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.
thank you!
Describe your changes
Add code to automatically name searchprofiles as
Searchprofile 1
,Searchprofile 2
, etc.Tasks