]> git.parisson.com Git - telemeta.git/commitdiff
fix auto_code, fix collection zip package filename, update sandbox/settings
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 18 Dec 2014 11:38:32 +0000 (12:38 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 18 Dec 2014 11:38:32 +0000 (12:38 +0100)
example/sandbox/settings.py
telemeta/views/collection.py
telemeta/views/item.py

index 33ea4882fbed6378ef659f68d6e3567dd6d8ff14..d078bb51a30786a8569d16811b359dc7ad540da9 100644 (file)
@@ -4,11 +4,14 @@
 import os, sys
 from django.core.urlresolvers import reverse_lazy, reverse
 
+sys.dont_write_bytecode = True
+
+BASE_DIR = os.path.dirname(os.path.dirname(__file__))
+
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
-# ALLOWED_HOSTS = ('localhost',)
-sys.dont_write_bytecode = True
 
+ALLOWED_HOSTS = ['*']
 
 ADMINS = (
     ('Guillaume Pellerin', 'yomguy@parisson.com'),
@@ -58,10 +61,10 @@ USE_L10N = True
 
 # Absolute path to the directory that holds media.
 # Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'media/')
+MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
 
 if not os.path.exists(MEDIA_ROOT):
-       os.mkdir(MEDIA_ROOT)
+    os.mkdir(MEDIA_ROOT)
 
 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
 # trailing slash if there is a path component (optional in other cases).
@@ -164,10 +167,13 @@ SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
 TELEMETA_ORGANIZATION = 'Parisson'
 TELEMETA_SUBJECTS = ('test', 'telemeta', 'sandbox')
 TELEMETA_DESCRIPTION = "Telemeta TEST sandbox"
+TELEMETA_LOGO = STATIC_URL + 'telemeta/images/logo_telemeta_2.png'
+
 TELEMETA_GMAP_KEY = 'ABQIAAAArg7eSfnfTkBRma8glnGrlxRVbMrhnNNvToCbZQtWdaMbZTA_3RRGObu5PDoiBImgalVnnLU2yN4RMA'
-TELEMETA_CACHE_DIR = MEDIA_ROOT + 'cache/'
-TELEMETA_EXPORT_CACHE_DIR = MEDIA_ROOT + 'export/'
-TELEMETA_DATA_CACHE_DIR = TELEMETA_CACHE_DIR + "data/"
+
+TELEMETA_CACHE_DIR = os.path.join(MEDIA_ROOT, 'cache')
+TELEMETA_EXPORT_CACHE_DIR = os.path.join(MEDIA_ROOT, 'export')
+TELEMETA_DATA_CACHE_DIR = os.path.join(TELEMETA_CACHE_DIR, 'data')
 
 TELEMETA_DOWNLOAD_ENABLED = True
 TELEMETA_STREAMING_FORMATS = ('mp3', 'ogg')
@@ -220,3 +226,28 @@ DEBUG_TOOLBAR_PANELS = [
 SUIT_CONFIG = {
     'ADMIN_NAME': 'Telemeta Admin'
 }
+
+
+# LOG_DIR = os.path.join(BASE_DIR, 'log')
+
+# if not os.path.exists(LOG_DIR):
+#     os.mkdir(LOG_DIR)
+
+# LOGGING = {
+#     'version': 1,
+#     'disable_existing_loggers': False,
+#     'handlers': {
+#         'file': {
+#             'level': 'DEBUG',
+#             'class': 'logging.FileHandler',
+#             'filename': os.path.join(LOG_DIR, 'debug.log')
+#         },
+#     },
+#     'loggers': {
+#         'django.request': {
+#             'handlers': ['file'],
+#             'level': 'DEBUG',
+#             'propagate': True,
+#         },
+#     },
+# }
index 06bd2c744e9538cf63f0b1c45531604e229db42d..db5916eb98107641b32b6bf15ec00640e4f1b03d 100644 (file)
@@ -221,7 +221,7 @@ class CollectionPackageView(View):
             response = HttpResponse(z, content_type='application/zip')
 
         response['Content-Disposition'] = "attachment; filename=%s.%s" % \
-                                             (item.code, 'zip')
+                                             (collection.code, 'zip')
         return response
 
     @method_decorator(login_required)
index 82816baa24538e98692898e788f8a2481bbe456e..2adebde992f44c4f79de3ee66b2e336675fdab99 100644 (file)
@@ -769,7 +769,7 @@ class ItemAddView(ItemViewMixin, CreateWithInlinesView):
                 collection = collections[0]
                 item.collection = collection
                 items = MediaItem.objects.filter(collection=collection)
-                item.code = auto_code(items, collection.code)
+                item.code = auto_code(collection)
         return model_to_dict(item)
 
     def get_success_url(self):