-
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
[8473] add kiezradar models #5740
base: dev
Are you sure you want to change the base?
Conversation
48ccbd5
to
312553f
Compare
meinberlin/apps/kiezradar/views.py
Outdated
search_profile = serializer.save() | ||
|
||
# Define topics or retrieve from request data | ||
topics = self.request.data.get("topics", ["Default Topic 1", "Default Topic 2"]) |
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.
I added the default ones for testing purposes.
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.
Added some questions and a note regarding providing_args
meinberlin/apps/kiezradar/models.py
Outdated
|
||
|
||
class KiezRadarFilter(models.Model): | ||
topic = models.CharField(max_length=126, unique=True) |
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.
I'm not entirely sure if I follow the structure here, do we need the KiezRadarFilter
because it will be extended at some point in the future? Because if it only has the topic
we could also just have a m2m to the Topic
model on the SearchProfile
, right? And in the case here: would it make more sense for the topic to be a foreign key on Topic
instead of a CharField
? This way only topics which are defined can be added
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.
I understood the multiselect filter later will have options that are added either by admins/initiators, or on the fly like keywords, while creating the search profile, not from the topics which come from the django settings. Also the topic field here could be a json field which combines different topics. Need to ask PM for clarification.
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.
my understanding of the story was that currently we only add the existing filters:
- project title (free text)
- organisation (m2m)
- type (informational, participation, ...) (multi select)
- status (all, running, ended) (single select)
- district (m2m)
- topic (as in the settings) (m2m)
and you can select multiple options per filter (except for status filter). Maybe we can talk about it in daily again with the responsible PM as I don't remember anything about admins/initiators being able to add options so might be good to clarify
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.
Clarified now, topics are the one predefined. Bur multiple filters for all categories, will result in search profiles that are almost similar for different free text searches, and too many relations.
meinberlin/apps/kiezradar/views.py
Outdated
topics = self.request.data.get("topics", ["Default Topic 1", "Default Topic 2"]) | ||
|
||
# Send the custom signal with topics | ||
add_kiezradars_to_profile.send( |
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.
Why do we need a signal here? can't we just add the topics to the search_profile
directly?
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.
Because of the m2m relation, search profile needs to be saved first in order to add topics, that's why the signal is post_save
.
312553f
to
33f6706
Compare
Describe your changes
text
field which can accommodate free text query.Issues:
How to avoid user creating Search Profiles that are very similar. Maybe also add a limitation on how many search profiles they can have, as it can quickly scale up.
Tasks