diff --git a/requirements/base.in b/requirements/base.in index d38f35becf4d4f536496f0838654018c439ffb26..84ce1c98213e06963da8ab3b722b9c5c39f83d2a 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -2,3 +2,4 @@ Django==2.0.1 djangorestframework==3.7.7 django-social-authsch==0.1 django-solo==1.1.3 +django-import-export==1.0.0 diff --git a/requirements/development.txt b/requirements/development.txt index 2806f075fd5fcbc4a0f09bead0d99fff22a3401b..23ec9249da5d8fb5961e4ee464cf3b766be8de7c 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -9,19 +9,25 @@ chardet==3.0.4 # via requests click==6.7 # via pip-tools configparser==3.5.0 # via python-language-server defusedxml==0.5.0 # via python3-openid, social-auth-core +diff-match-patch==20121119 # via django-import-export django-extensions==1.9.9 +django-import-export==1.0.0 django-social-authsch==0.1 django-solo==1.1.3 django==2.0.1 djangorestframework==3.7.7 +et-xmlfile==1.0.1 # via openpyxl first==2.0.1 # via pip-tools flake8==3.4.1 future==0.16.0 # via python-language-server idna==2.6 # via requests +jdcal==1.3 # via openpyxl jedi==0.11.1 # via python-language-server json-rpc==1.10.8 # via python-language-server mccabe==0.6.1 # via flake8, python-language-server oauthlib==2.0.6 # via requests-oauthlib, social-auth-core +odfpy==1.3.6 # via tablib +openpyxl==2.5.0 # via tablib parso==0.1.1 # via jedi pip-tools==1.9.0 pluggy==0.6.0 # via python-language-server @@ -32,6 +38,7 @@ pyjwt==1.5.3 # via social-auth-core python-language-server==0.13.0 python3-openid==3.1.0 # via social-auth-core pytz==2017.2 # via django +pyyaml==3.12 # via tablib requests-oauthlib==0.8.0 # via social-auth-core requests==2.18.4 # via requests-oauthlib, social-auth-core rope==0.10.7 # via python-language-server @@ -39,6 +46,10 @@ six==1.10.0 # via django-extensions, pip-tools, pydocstyle, social snowballstemmer==1.2.1 # via pydocstyle social-auth-app-django==2.0.0 # via django-social-authsch social-auth-core==1.5.0 # via django-social-authsch, social-auth-app-django +tablib==0.12.1 # via django-import-export typing==3.6.4 # via django-extensions +unicodecsv==0.14.1 # via tablib urllib3==1.22 # via requests +xlrd==1.1.0 # via tablib +xlwt==1.3.0 # via tablib yapf==0.20.1 # via python-language-server diff --git a/requirements/production.txt b/requirements/production.txt index 31199b03b9b308ed7759df6e635f9971d07e2ed5..273e15c71ee53d8d4e3b2f06dd75e73ff337c457 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -7,19 +7,30 @@ certifi==2018.1.18 # via requests chardet==3.0.4 # via requests defusedxml==0.5.0 # via python3-openid, social-auth-core +diff-match-patch==20121119 # via django-import-export +django-import-export==1.0.0 django-social-authsch==0.1 django-solo==1.1.3 django==2.0.1 djangorestframework==3.7.7 +et-xmlfile==1.0.1 # via openpyxl gunicorn==19.7.1 idna==2.6 # via requests +jdcal==1.3 # via openpyxl oauthlib==2.0.6 # via requests-oauthlib, social-auth-core +odfpy==1.3.6 # via tablib +openpyxl==2.5.0 # via tablib pyjwt==1.5.3 # via social-auth-core python3-openid==3.1.0 # via social-auth-core pytz==2017.3 # via django +pyyaml==3.12 # via tablib requests-oauthlib==0.8.0 # via social-auth-core requests==2.18.4 # via requests-oauthlib, social-auth-core six==1.11.0 # via social-auth-app-django, social-auth-core social-auth-app-django==2.1.0 # via django-social-authsch social-auth-core==1.6.0 # via django-social-authsch, social-auth-app-django +tablib==0.12.1 # via django-import-export +unicodecsv==0.14.1 # via tablib urllib3==1.22 # via requests +xlrd==1.1.0 # via tablib +xlwt==1.3.0 # via tablib diff --git a/src/account/admin.py b/src/account/admin.py index 3977099f0b803d0214933039309e11ae5162b5bf..388129c8f6d559b75b77afdd0cdf57bab932fd9c 100644 --- a/src/account/admin.py +++ b/src/account/admin.py @@ -1,11 +1,15 @@ from django.contrib import admin -from . import models from solo.admin import SingletonModelAdmin +from import_export.admin import ExportMixin + +from . import models +from . import resources @admin.register(models.Profile) -class ProfileAdmin(admin.ModelAdmin): +class ProfileAdmin(ExportMixin, admin.ModelAdmin): list_display = ('user_username', 'join_date') + resource_class = resources.SignUpResource def user_username(self, obj): return obj.user.username diff --git a/src/account/resources.py b/src/account/resources.py new file mode 100644 index 0000000000000000000000000000000000000000..9e11f54b67b8e0ca17e1865fa03edd8461a65c4b --- /dev/null +++ b/src/account/resources.py @@ -0,0 +1,15 @@ +from import_export import resources +from . import models + + +class SignUpResource(resources.ModelResource): + class Meta: + model = models.Profile + fields = ( + 'user__first_name', + 'user__last_name', + 'user__email', + 'motivation_about', + 'motivation_profession', + 'motivation_exercise', + ) diff --git a/src/kszkepzes/settings/base.py b/src/kszkepzes/settings/base.py index 91ebe6e357cb0757895d7854854c35036acf4227..e19f0ee83398dac0da425ea3298ec6a593a1ab9d 100644 --- a/src/kszkepzes/settings/base.py +++ b/src/kszkepzes/settings/base.py @@ -38,6 +38,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'django_extensions', + 'import_export', 'rest_framework', 'social_django', 'solo',