Pārlūkot izejas kodu

No seum counters now displayed at the bottom

Denis Merigoux 9 gadi atpakaļ
vecāks
revīzija
3556dc08dc
4 mainītis faili ar 15 papildinājumiem un 8 dzēšanām
  1. 1 0
      .gitignore
  2. 10 0
      README.md
  3. 3 5
      counter/views.py
  4. 1 3
      seum/settings.py.default

+ 1 - 0
.gitignore

@@ -67,3 +67,4 @@ target/
67 67
 #Custom
68 68
 python3/
69 69
 seum/settings.py
70
+seum.json

+ 10 - 0
README.md

@@ -52,3 +52,13 @@ To give Apache the permission to serve the files, execute these three commands :
52 52
 To launch or restart the server, simply run :
53 53
 
54 54
     sudo service apache2 restart
55
+
56
+### Backup data
57
+
58
+To backup the database, execute the command
59
+
60
+    python manage.py dumpdata --exclude contenttypes > seum.json
61
+
62
+You can then restore your data into a freshly migrated new database with
63
+
64
+    python manage.py loaddata seum.json

+ 3 - 5
counter/views.py

@@ -25,10 +25,8 @@ def home(request):
25 25
     JSS_limit = 7
26 26
     maxJSS = 0
27 27
     bestSeumeursNumber = 15
28
-    # Display counters
29 28
     lastResets = []
30
-    # Calculates infos for each counter
31
-    timezero = timedelta(0)
29
+    no_seum_delta = timedelta.max
32 30
 
33 31
     # First select our counter
34 32
     try:
@@ -38,7 +36,7 @@ def home(request):
38 36
         if (lastReset.count() == 0):
39 37
             # This person never had the seum
40 38
             myCounter.lastReset = Reset()
41
-            myCounter.lastReset.delta = timezero
39
+            myCounter.lastReset.delta = no_seum_delta
42 40
             myCounter.lastReset.noSeum = True
43 41
         else:
44 42
             myCounter.lastReset = lastReset[0]
@@ -65,7 +63,7 @@ def home(request):
65 63
         if (lastReset.count() == 0):
66 64
             # This person never had the seum
67 65
             counter.lastReset = Reset()
68
-            counter.lastReset.delta = timezero
66
+            counter.lastReset.delta = no_seum_delta
69 67
             counter.lastReset.noSeum = True
70 68
             counter.CSSclass = "warning"
71 69
         else:

+ 1 - 3
seum/settings.py.default

@@ -26,9 +26,6 @@ SECRET_KEY = '(#lovv#uky9unr9azzqy14gktpf0(d&+cp@++l95*y4e%m%_ex'
26 26
 # SECURITY WARNING: don't run with debug turned on in production!
27 27
 DEBUG = True
28 28
 
29
-ALLOWED_HOSTS = ['seum.merigoux.ovh']
30
-
31
-
32 29
 # Application definition
33 30
 
34 31
 INSTALLED_APPS = [
@@ -124,6 +121,7 @@ SESSION_COOKIE_SECURE = True
124 121
 CSRF_COOKIE_SECURE = True
125 122
 CSRF_COOKIE_HTTPONLY = True
126 123
 X_FRAME_OPTIONS = 'DENY'
124
+ALLOWED_HOSTS = ['seum.merigoux.ovh']
127 125
 
128 126
 
129 127
 #login