diff --git a/.gitignore b/.gitignore
index 6cfebb4..8a02841 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,3 +45,4 @@ static/
Pipfile
mediafiles
Pipfile.lock
+contributors.txt
diff --git a/coopeV3/management/commands/gencontributors.py b/coopeV3/management/commands/gencontributors.py
new file mode 100644
index 0000000..a8850bc
--- /dev/null
+++ b/coopeV3/management/commands/gencontributors.py
@@ -0,0 +1,15 @@
+from django.core.management.base import BaseCommand, CommandError
+from django.conf import settings
+
+import subprocess
+
+class Command(BaseCommand):
+ help = 'Generate the git contributors file'
+
+ def handle(self, *args, **options):
+ try:
+ subprocess.call("rm " + settings.BASE_DIR + "/contributors.txt", shell=True)
+ except:
+ pass
+ subprocess.call("git -C " + settings.BASE_DIR + " shortlog -n $@ | grep \"):\" | sed 's|:||' >> " + settings.BASE_DIR + "/contributors.txt", shell=True)
+ subprocess.call("cat " + settings.BASE_DIR + "/contributors.txt", shell=True)
\ No newline at end of file
diff --git a/coopeV3/views.py b/coopeV3/views.py
index e9108b8..e04eec0 100644
--- a/coopeV3/views.py
+++ b/coopeV3/views.py
@@ -44,14 +44,13 @@ def about(request):
"""
A page about the project
"""
- os.system("git -C " + settings.BASE_DIR + " shortlog -n $@ | grep \"):\" | sed 's|:||' >> " + settings.BASE_DIR + "/contributors.txt")
contributors = []
- with open(settings.BASE_DIR + "/contributors.txt", "r") as f:
- for line in f:
- print(line)
- print(line.split(" ")[0])
- contributors.append((line.split(" ")[0], int(line.split(" ")[1].replace("(", "").replace(")", "").replace("\n", ""))))
- os.system("rm " + settings.BASE_DIR + "/contributors.txt")
+ try:
+ with open(settings.BASE_DIR + "/contributors.txt", "r") as f:
+ for line in f:
+ contributors.append((line[:line.find('(')], int(line[(line.find('(') + 1):line.find(')')])))
+ except:
+ pass
license = []
with open(settings.BASE_DIR + "/LICENSE", "r") as f:
for line in f:
diff --git a/templates/about.html b/templates/about.html
index 8623bfe..6aaf994 100644
--- a/templates/about.html
+++ b/templates/about.html
@@ -28,8 +28,6 @@
{% endfor %}
(https://github.com/nanoy42/coope/blob/master/LICENSE).
-
- Version 3.6.2.
@@ -37,12 +35,16 @@
Contributeurs
+ {% if contributors %}
Les contributeurs, triés par ordre décroissant de nombre de commits, sont:
{% for contributor in contributors %}
- {{contributor.0}} ({{contributor.1}} commits)
{% endfor %}
+ {% else %}
+ Impossible d'afficher la liste des contributeurs
+ {% endif %}
{% endblock %}