tinymce_6

This commit is contained in:
alazo 2017-04-12 08:52:38 +02:00
parent adc335178b
commit ca290769ff
4 changed files with 7 additions and 24 deletions

3
.gitignore vendored
View file

@ -5,4 +5,7 @@ db.eds
db.* db.*
*.sql *.sql
*.csv *.csv
*.xls
*.xlsx
.* .*

View file

@ -397,29 +397,10 @@ def Download(request, file_name):
def pdf_view(request): def pdf_view(request):
with open('/home/alzo/dev/eds/media/media/EDS_Calendrier_2017.pdf', 'r') as pdf: with open(settings.MEDIA_ROOT + '/media/EDS_Calendrier_2017.pdf', 'r') as pdf:
response = HttpResponse(pdf.read().decode('latin-1') , content_type='application/pdf') response = HttpResponse(pdf.read().decode('latin-1') , content_type='application/pdf')
response['Content-Disposition'] = 'inline;filename=some_file.pdf' response['Content-Disposition'] = 'inline;filename=some_file.pdf'
return response return response
pdf.closed pdf.closed
def import_xls_file(request):
import xlrd
if request.method == 'POST':
xlspath = '/home/alzo/Export_CLOEE_FE.xls'
with xlrd.open_workbook(xlspath) as book:
sheet = book.sheet_by_index(0)
print(sheet.ncols)
print(sheet.nrows)
if request.method == 'GET':
xlspath = '/home/alzo/Export_CLOEE_FE.xls'
with xlrd.open_workbook(xlspath) as book:
sheet = book.sheet_by_index(0)
for rownum in range(1,sheet.nrows):
print(int(sheet.row_values(rownum)[0]))

View file

@ -112,10 +112,10 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.10/howto/static-files/ # https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
MEDIA_URL = '/media/' MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
STUDENT_IMPORT_MAPPING = { STUDENT_IMPORT_MAPPING = {
'Num élève': 'id_ext', 'Num élève': 'id_ext',

View file

@ -38,6 +38,5 @@ urlpatterns = [
url(r'^module_pdf/(?P<pk>\d+)$', views.ModulePDF.as_view(), name='module-pdf'), url(r'^module_pdf/(?P<pk>\d+)$', views.ModulePDF.as_view(), name='module-pdf'),
url(r'^documents/$', views.DocumentListView.as_view(), name='document-list'), url(r'^documents/$', views.DocumentListView.as_view(), name='document-list'),
url(r'^document/(?P<pk>\d+)$', views.DocumentDetailView.as_view(), name='document-detail'), url(r'^document/(?P<pk>\d+)$', views.DocumentDetailView.as_view(), name='document-detail'),
url(r'^import/$', views.import_xls_file),
url(r'^tinymce/', include('tinymce.urls'), name='tinymce-js'), url(r'^tinymce/', include('tinymce.urls'), name='tinymce-js'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)