django-survey | simple django framework for creating and conducting surveys | Form library
kandi X-RAY | django-survey Summary
kandi X-RAY | django-survey Summary
Using the admin interface you can create surveys, add questions, give questions categories, and mark them as required or not. the front-end survey view then automatically populates based on the questions that have been defined in the admin interface. Submitted responses can also be viewed via the admin backend.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Sizes all the slides based on their dimensions
- Builds the dates array
- The default refrester handler .
- Callback for when we re done
- Loads scripts into a single page .
- Go to the next slide
- Creates collapse options
- Creates a new matcher matcher .
- Create an animation
- Loads all the places between Google Maps Maps
django-survey Key Features
django-survey Examples and Code Snippets
Community Discussions
Trending Discussions on django-survey
QUESTION
I'm trying to build two abstract classes called SurveyQuestionBase
and SurveyResponseBase
that will serve as templates to quickly define new concrete Models for implementing specific surveys on our website. The issue I am having is in enforcing that the SurveyResponseBase
model, when made concrete, should define a ForeignKey
to a concrete model of SurveyQuestionBase
.
Django does not allow us to define ForeignKeys
to abstract classes so I cannot, for instance, do this:
question = models.ForeignKey(SurveyQuestionBase)
Neither can I have it as None
or app_label.ModelName
for similar reasons.
One hacky fix is to create a new concrete model SurveyQuestionConcrete
and make the ForeignKey
point to this: question = models.ForeignKey(concrete_model)
, combined with validation to ensure this model is replaced.
Is there a cleaner way to achieve the same thing? All I need to do is ensure that when someone defines a concrete model from SurveyResponseBase
they include a ForeignKey
to a concrete model defined from SurveyQuestionBase
Here's the full code:
...ANSWER
Answered 2017-Jul-07 at 07:45I believe you can't do that because the ForeignKey doesn't know what actual model to point to.
You may be looking for GenericForeignKey (https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#generic-relations). It allows you to define that relationship properly.
QUESTION
Let's suppose I have a polymorphic model and I want to get rid of it.
...ANSWER
Answered 2017-Jul-06 at 12:31You could create an empty migration for the app you want to do these modifications and use the migrations.RunPython Class to execute custom python functions.
- Inside these functions you can have access to your models
- The Django ORM that you can do data manipulation.
- Pure python, no raw SQL.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-survey
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page