-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Django-admin-import-export package added.
- Loading branch information
1 parent
ffd1ed5
commit ea7d97a
Showing
4 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,31 @@ | ||
from django.contrib import admin | ||
from import_export import resources | ||
from import_export.admin import ImportExportModelAdmin | ||
|
||
from questionnaire import models | ||
|
||
|
||
class SurveyResource(resources.ModelResource): | ||
class Meta: | ||
model = models.Survey | ||
fields = [field.name for field in models.Survey._meta.fields] | ||
|
||
|
||
class SurveyAdmin(ImportExportModelAdmin): | ||
resource_class = SurveyResource | ||
list_display = [field.name for field in models.Survey._meta.fields] | ||
|
||
|
||
class FamilyDetailsResource(resources.ModelResource): | ||
class Meta: | ||
model = models.FamilyDetails | ||
fields = [field.name for field in models.FamilyDetails._meta.fields] | ||
|
||
|
||
class FamilyDetailsAdmin(ImportExportModelAdmin): | ||
resource_class = FamilyDetailsResource | ||
list_display = [field.name for field in models.FamilyDetails._meta.fields] | ||
|
||
|
||
admin.site.register(models.Survey, SurveyAdmin) | ||
admin.site.register(models.FamilyDetails, FamilyDetailsAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
backports.csv==1.0.7 | ||
defusedxml==0.6.0 | ||
diff-match-patch==20181111 | ||
dj-database-url==0.5.0 | ||
Django==2.2.5 | ||
django-import-export==1.2.0 | ||
django-modeladmin-reorder==0.3.1 | ||
djangorestframework==3.10.3 | ||
et-xmlfile==1.0.1 | ||
gunicorn==19.9.0 | ||
jdcal==1.4.1 | ||
mysqlclient==1.4.2.post1 | ||
odfpy==1.4.0 | ||
openpyxl==2.6.3 | ||
python-decouple==3.1 | ||
pytz==2019.2 | ||
PyYAML==5.1.2 | ||
sqlparse==0.3.0 | ||
tablib==0.13.0 | ||
whitenoise==4.1.3 | ||
psycopg2==2.8.3 | ||
xlrd==1.2.0 | ||
xlwt==1.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters