Skip to content
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

Default value for a field #77

Open
ebdavison opened this issue Feb 16, 2020 · 3 comments
Open

Default value for a field #77

ebdavison opened this issue Feb 16, 2020 · 3 comments
Labels
enhancement This is a feature not a bug hacktoberfest

Comments

@ebdavison
Copy link

I have a use case where I need to be able to put a default value for a field for one of the questions. The user can always change it but that is not the scope of this issue.

@Pierre-Sassoulas Pierre-Sassoulas added the enhancement This is a feature not a bug label Feb 16, 2020
@Pierre-Sassoulas
Copy link
Owner

Nice feature! It's probably a small change doable by adding a default value field here: https://github.com/Pierre-Sassoulas/django-survey/blob/master/survey/models/question.py#L73 with default value = None in order to make migrations from older survey possible. There might be more work to be able to handle all possible type of questions and make sure not having a default still works.

@ebdavison
Copy link
Author

I don't see how putting the default value in the model is the answer. You already have a "default value" for when the user did not enter any data with USER_DID_NOT_ANSWER in settings.py. I was really thinking that when a survey question is created, the user creating it can enter a default value. Like, in my other issues, the week the survey is for. That way the user can see it is entered and keep the value. So it is really a per-question default rather than a model default that I am after.

@Pierre-Sassoulas
Copy link
Owner

Hmm, yeah it makes sense to have the value for USER_DID_NOT_ANSWER as default instead of None. If this is a default value for a question to a survey by a user for each user, maybe it needs another concept than the Question model. I'm not sure about it but I don't think the Question model has the necessary N-N relationship with Survey and User. It looks harder to do than I thougth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is a feature not a bug hacktoberfest
Projects
None yet
Development

No branches or pull requests

2 participants