Просмотр исходного кода

No seum counters now displayed at the bottom

Denis Merigoux лет назад: 9
Родитель
Сommit
3556dc08dc
4 измененных файлов с 15 добавлено и 8 удалено
  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
 #Custom
67
 #Custom
68
 python3/
68
 python3/
69
 seum/settings.py
69
 seum/settings.py
70
+seum.json

+ 10 - 0
README.md

52
 To launch or restart the server, simply run :
52
 To launch or restart the server, simply run :
53
 
53
 
54
     sudo service apache2 restart
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
     JSS_limit = 7
25
     JSS_limit = 7
26
     maxJSS = 0
26
     maxJSS = 0
27
     bestSeumeursNumber = 15
27
     bestSeumeursNumber = 15
28
-    # Display counters
29
     lastResets = []
28
     lastResets = []
30
-    # Calculates infos for each counter
31
-    timezero = timedelta(0)
29
+    no_seum_delta = timedelta.max
32
 
30
 
33
     # First select our counter
31
     # First select our counter
34
     try:
32
     try:
38
         if (lastReset.count() == 0):
36
         if (lastReset.count() == 0):
39
             # This person never had the seum
37
             # This person never had the seum
40
             myCounter.lastReset = Reset()
38
             myCounter.lastReset = Reset()
41
-            myCounter.lastReset.delta = timezero
39
+            myCounter.lastReset.delta = no_seum_delta
42
             myCounter.lastReset.noSeum = True
40
             myCounter.lastReset.noSeum = True
43
         else:
41
         else:
44
             myCounter.lastReset = lastReset[0]
42
             myCounter.lastReset = lastReset[0]
65
         if (lastReset.count() == 0):
63
         if (lastReset.count() == 0):
66
             # This person never had the seum
64
             # This person never had the seum
67
             counter.lastReset = Reset()
65
             counter.lastReset = Reset()
68
-            counter.lastReset.delta = timezero
66
+            counter.lastReset.delta = no_seum_delta
69
             counter.lastReset.noSeum = True
67
             counter.lastReset.noSeum = True
70
             counter.CSSclass = "warning"
68
             counter.CSSclass = "warning"
71
         else:
69
         else:

+ 1 - 3
seum/settings.py.default

26
 # SECURITY WARNING: don't run with debug turned on in production!
26
 # SECURITY WARNING: don't run with debug turned on in production!
27
 DEBUG = True
27
 DEBUG = True
28
 
28
 
29
-ALLOWED_HOSTS = ['seum.merigoux.ovh']
30
-
31
-
32
 # Application definition
29
 # Application definition
33
 
30
 
34
 INSTALLED_APPS = [
31
 INSTALLED_APPS = [
124
 CSRF_COOKIE_SECURE = True
121
 CSRF_COOKIE_SECURE = True
125
 CSRF_COOKIE_HTTPONLY = True
122
 CSRF_COOKIE_HTTPONLY = True
126
 X_FRAME_OPTIONS = 'DENY'
123
 X_FRAME_OPTIONS = 'DENY'
124
+ALLOWED_HOSTS = ['seum.merigoux.ovh']
127
 
125
 
128
 
126
 
129
 #login
127
 #login