Question

Using Django 1.5, I need a Default values button with my form.

The form is a forms.ModelForm and the model is populated using Django fixtures when the application is deployed. Basically, the reset button would fetch the fixture content and update the form content with it.

Do I have to open the fixture file with os and stuff ?

Was it helpful?

Solution

IMHO you need to create a record (e.g. the first record in the table) with the fixture content and load that when needed. You'd need to get the record ID (which you can set in the fixture) and use it (either hardcoded or with other method) in your view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top