]> git.parisson.com Git - telemeta.git/commitdiff
Fix various form fields, fix delete cache file, fix deprecated
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 12 Mar 2018 11:05:54 +0000 (12:05 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 12 Mar 2018 11:07:14 +0000 (12:07 +0100)
app/scripts/app.sh
app/settings.py
telemeta/cache.py
telemeta/forms/language.py
telemeta/forms/media.py
telemeta/forms/system.py
telemeta/models/location.py
telemeta/views/enum.py

index 461191afe337b93fe6d774fd5c2984aa47ae308f..916f2e1ed4d8074274007a51419b4935d27e5c52 100644 (file)
@@ -7,17 +7,19 @@ wsgi=$app'/wsgi.py'
 static='/srv/static/'
 media='/srv/media/'
 src='/srv/src/'
+log='/var/log/uwsgi/app.log'
 
 # uwsgi params
 port=8000
-processes=8
-threads=8
+processes=2
+threads=2
 uid='www-data'
 gid='www-data'
 patterns='*.js;*.css;*.jpg;*.jpeg;*.gif;*.png;*.svg;*.ttf;*.eot;*.woff;*.woff2'
 
 # stating apps
 # pip install django-bootstrap3==6.2.1
+pip install south
 
 # waiting for other network services
 sh $app/scripts/wait.sh
@@ -60,5 +62,5 @@ else
     # app start
     uwsgi --socket :$port --wsgi-file $wsgi --chdir $app --master \
         --processes $processes --threads $threads \
-        --uid $uid --gid $gid --touch-reload $wsgi
+        --uid $uid --gid $gid --logto $log --touch-reload $wsgi
 fi
index 62e73c64f6cc078335eafe1c69b65cbebfad76d5..0bb4058c9d466fa7c9f96f80590e26df6d16bee4 100644 (file)
@@ -12,6 +12,7 @@ env = environ.Env(DEBUG=(bool, False),
 
 # Django settings for server project.
 DEBUG = env('DEBUG') # False if not in os.environ
+DEBUG=True
 TEMPLATE_DEBUG = DEBUG
 
 sys.dont_write_bytecode = True
@@ -155,7 +156,7 @@ INSTALLED_APPS = (
     'timeside.player',
     #'timeside.server',
     'jsonrpc',
-    'south',
+    'south',
     'sorl.thumbnail',
     'timezones',
     'jqchat',
index f26fa5d408a0908b684ef1186616a0bed3f66579..bd8cc41bc4f04af4dd7715d0bbaa13ac3db5d6fe 100644 (file)
@@ -55,8 +55,10 @@ class TelemetaCache(object):
     def delete_item_data(self, public_id):
         # public_id is the public_id of an item
         for file in self.files:
+            path = self.dir + os.sep + file
             if public_id in file:
-                os.remove(self.dir + os.sep + file)
+                if os.path.exists(path):
+                    os.remove(path)
 
     def write_bin(self, data, file):
         path = self.dir + os.sep + file
index c2dc960ac75efe4ca32c956045c5abb6721d5c31..5c7cbeb1307e0454c1ff7df448ccdfe25bfacba5 100644 (file)
@@ -22,6 +22,9 @@
 from django.forms import ModelForm
 from telemeta.models import *
 
+
 class LanguageForm(ModelForm):
+
     class Meta:
         model = Language
+        fields = ('__all__')
index 88bd77cc610850387ad10206d26c7bea1aa40ce2..e48536ed08918801e0a45cffe3273e8d3275291b 100644 (file)
@@ -98,6 +98,7 @@ class PlaylistForm(ModelForm):
 
     class Meta:
         model = Playlist
+        fields = ('__all__')
 
 
 class FondsRelatedInline(InlineFormSet):
index f45754f4a5b965dbeb0d2ee5d817b01dd5dad9e5..b1ae8e473dc490a9f03e37f8a8d7c2e94ee4e738 100644 (file)
@@ -24,5 +24,7 @@ from telemeta.models import *
 
 
 class UserProfileForm(ModelForm):
+
     class Meta:
         model = UserProfile
+        fields = ('__all__')
index 084d4cc900c1f9e3c004b4167fdc9d4817d6653d..a731861255791a84021f6f6c2a55dd3d59923117 100644 (file)
@@ -189,10 +189,11 @@ class LocationRelation(ModelCore):
 
 
 class LocationForm(ModelForm):
+
     class Meta:
         model = Location
+        fields = ('__all__')
 
     def __init__(self, *args, **kwds):
         super(LocationForm, self).__init__(*args, **kwds)
 #        self.fields['name'].queryset = Location.objects.order_by('name')
-
index 1a8583eea98aaffe3e806e6c597c547b225825b7..cb36814c7d3848c00a5a507bfc2aedc0507da870 100644 (file)
@@ -21,7 +21,7 @@ class EnumView(object):
         if enumeration == None or enumeration.admin == "True":
             raise Http404
         vars = self.__get_admin_context_vars()
-        vars["enumeration_id"] = enumeration._meta.module_name
+        vars["enumeration_id"] = enumeration._meta.model_name
         vars["enumeration_name"] = enumeration._meta.verbose_name
         vars["enumeration_values"] = enumeration.objects.all()
         vars["enumeration_support"] = ""
@@ -56,7 +56,7 @@ class EnumView(object):
         for model in models:
             if issubclass(model, Enumeration):
                 for enu in tab2:
-                    if model._meta.module_name == enu["nom"]:
+                    if model._meta.model_name == enu["nom"]:
                         model.admin = enu["admin"]
 
     def __get_enumerations_list(self):
@@ -65,10 +65,10 @@ class EnumView(object):
         enumerations = []
         for model in models:
             if issubclass(model, Enumeration):
-                enumeration_property = EnumerationProperty.objects.get(enumeration_name=model._meta.module_name)
+                enumeration_property = EnumerationProperty.objects.get(enumeration_name=model._meta.model_name)
                 if not enumeration_property.is_hidden and not enumeration_property.is_admin:
                     enumerations.append({"name": model._meta.verbose_name,
-                                         "id": model._meta.module_name
+                                         "id": model._meta.model_name
                                          })
 
         cmp = lambda obj1, obj2: unaccent_icmp(obj1['name'], obj2['name'])
@@ -79,10 +79,10 @@ class EnumView(object):
         from django.db.models import get_models
         models = get_models(telemeta.models)
         for model in models:
-            if model._meta.module_name == id:
+            if model._meta.model_name == id:
                 break
 
-        if model._meta.module_name != id:
+        if model._meta.model_name != id:
             return None
         return model