Skip to content
Snippets Groups Projects
Commit ce385c1d authored by Barnabás Czémán's avatar Barnabás Czémán
Browse files

Add export support

parent 221f12f8
No related branches found
No related tags found
No related merge requests found
...@@ -2,3 +2,4 @@ Django==2.0.1 ...@@ -2,3 +2,4 @@ Django==2.0.1
djangorestframework==3.7.7 djangorestframework==3.7.7
django-social-authsch==0.1 django-social-authsch==0.1
django-solo==1.1.3 django-solo==1.1.3
django-import-export==1.0.0
...@@ -9,19 +9,25 @@ chardet==3.0.4 # via requests ...@@ -9,19 +9,25 @@ chardet==3.0.4 # via requests
click==6.7 # via pip-tools click==6.7 # via pip-tools
configparser==3.5.0 # via python-language-server configparser==3.5.0 # via python-language-server
defusedxml==0.5.0 # via python3-openid, social-auth-core defusedxml==0.5.0 # via python3-openid, social-auth-core
diff-match-patch==20121119 # via django-import-export
django-extensions==1.9.9 django-extensions==1.9.9
django-import-export==1.0.0
django-social-authsch==0.1 django-social-authsch==0.1
django-solo==1.1.3 django-solo==1.1.3
django==2.0.1 django==2.0.1
djangorestframework==3.7.7 djangorestframework==3.7.7
et-xmlfile==1.0.1 # via openpyxl
first==2.0.1 # via pip-tools first==2.0.1 # via pip-tools
flake8==3.4.1 flake8==3.4.1
future==0.16.0 # via python-language-server future==0.16.0 # via python-language-server
idna==2.6 # via requests idna==2.6 # via requests
jdcal==1.3 # via openpyxl
jedi==0.11.1 # via python-language-server jedi==0.11.1 # via python-language-server
json-rpc==1.10.8 # via python-language-server json-rpc==1.10.8 # via python-language-server
mccabe==0.6.1 # via flake8, python-language-server mccabe==0.6.1 # via flake8, python-language-server
oauthlib==2.0.6 # via requests-oauthlib, social-auth-core 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 parso==0.1.1 # via jedi
pip-tools==1.9.0 pip-tools==1.9.0
pluggy==0.6.0 # via python-language-server pluggy==0.6.0 # via python-language-server
...@@ -32,6 +38,7 @@ pyjwt==1.5.3 # via social-auth-core ...@@ -32,6 +38,7 @@ pyjwt==1.5.3 # via social-auth-core
python-language-server==0.13.0 python-language-server==0.13.0
python3-openid==3.1.0 # via social-auth-core python3-openid==3.1.0 # via social-auth-core
pytz==2017.2 # via django pytz==2017.2 # via django
pyyaml==3.12 # via tablib
requests-oauthlib==0.8.0 # via social-auth-core requests-oauthlib==0.8.0 # via social-auth-core
requests==2.18.4 # via requests-oauthlib, social-auth-core requests==2.18.4 # via requests-oauthlib, social-auth-core
rope==0.10.7 # via python-language-server rope==0.10.7 # via python-language-server
...@@ -39,6 +46,10 @@ six==1.10.0 # via django-extensions, pip-tools, pydocstyle, social ...@@ -39,6 +46,10 @@ six==1.10.0 # via django-extensions, pip-tools, pydocstyle, social
snowballstemmer==1.2.1 # via pydocstyle snowballstemmer==1.2.1 # via pydocstyle
social-auth-app-django==2.0.0 # via django-social-authsch 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 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 typing==3.6.4 # via django-extensions
unicodecsv==0.14.1 # via tablib
urllib3==1.22 # via requests 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 yapf==0.20.1 # via python-language-server
...@@ -7,19 +7,30 @@ ...@@ -7,19 +7,30 @@
certifi==2018.1.18 # via requests certifi==2018.1.18 # via requests
chardet==3.0.4 # via requests chardet==3.0.4 # via requests
defusedxml==0.5.0 # via python3-openid, social-auth-core 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-social-authsch==0.1
django-solo==1.1.3 django-solo==1.1.3
django==2.0.1 django==2.0.1
djangorestframework==3.7.7 djangorestframework==3.7.7
et-xmlfile==1.0.1 # via openpyxl
gunicorn==19.7.1 gunicorn==19.7.1
idna==2.6 # via requests idna==2.6 # via requests
jdcal==1.3 # via openpyxl
oauthlib==2.0.6 # via requests-oauthlib, social-auth-core 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 pyjwt==1.5.3 # via social-auth-core
python3-openid==3.1.0 # via social-auth-core python3-openid==3.1.0 # via social-auth-core
pytz==2017.3 # via django pytz==2017.3 # via django
pyyaml==3.12 # via tablib
requests-oauthlib==0.8.0 # via social-auth-core requests-oauthlib==0.8.0 # via social-auth-core
requests==2.18.4 # via requests-oauthlib, 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 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-app-django==2.1.0 # via django-social-authsch
social-auth-core==1.6.0 # via django-social-authsch, social-auth-app-django 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 urllib3==1.22 # via requests
xlrd==1.1.0 # via tablib
xlwt==1.3.0 # via tablib
from django.contrib import admin from django.contrib import admin
from . import models
from solo.admin import SingletonModelAdmin from solo.admin import SingletonModelAdmin
from import_export.admin import ExportMixin
from . import models
from . import resources
@admin.register(models.Profile) @admin.register(models.Profile)
class ProfileAdmin(admin.ModelAdmin): class ProfileAdmin(ExportMixin, admin.ModelAdmin):
list_display = ('user_username', 'join_date') list_display = ('user_username', 'join_date')
resource_class = resources.SignUpResource
def user_username(self, obj): def user_username(self, obj):
return obj.user.username return obj.user.username
......
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',
)
...@@ -38,6 +38,7 @@ INSTALLED_APPS = [ ...@@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django_extensions', 'django_extensions',
'import_export',
'rest_framework', 'rest_framework',
'social_django', 'social_django',
'solo', 'solo',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment