aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2021-03-17 20:24:19 +0100
committerAndrea Lepori <alepori@student.ethz.ch>2021-03-17 20:25:28 +0100
commit23c9db0971c737456bb4f29308660ab8087ebfc4 (patch)
treeb016511ab936c3e87663e19174f90edbf2e3b506
parentlazyload of images in non admin page (diff)
downloadscout-subs-23c9db0971c737456bb4f29308660ab8087ebfc4.tar.gz
scout-subs-23c9db0971c737456bb4f29308660ab8087ebfc4.zip
add rev to version and create document from non primary group
Diffstat (limited to '')
-rw-r--r--.gitignore1
-rw-r--r--client/views.py22
-rw-r--r--version.txt3
3 files changed, 17 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 5842052..4655060 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ documents
apikey.sh
db.sqlite3
documents*
+.commit
diff --git a/client/views.py b/client/views.py
index b6e9832..32678f5 100644
--- a/client/views.py
+++ b/client/views.py
@@ -132,12 +132,10 @@ def index(request):
def create(request):
context = {}
# group name and obj
- parent_group = request.user.groups.values_list('name', flat=True)[
- 0]
- group = Group.objects.get(name=parent_group)
+ parent_groups = request.user.groups.values_list('name', flat=True)
# get available types for user
- filter = (Q(group_private=False) | Q(group=group)) & Q(enabled=True)
+ filter = (Q(group_private=False) | Q(group__name__in=parent_groups)) & Q(enabled=True)
if not request.user.is_staff and "capi" not in request.user.groups.values_list('name',flat = True):
filter = filter & Q(staff_only=False)
@@ -318,11 +316,19 @@ def edit_wrapper(request, context):
def about(request):
# very simple about page, get version from text file
version = ""
+
with open("version.txt", 'r') as f:
version = f.read()
- if version.startswith("0"):
- version = "Beta " + version
- commitid = check_output(["git", "rev-parse", "HEAD"]).decode()
- version = version[:version.find(" $Id: ")]
+
+ # parse file
+ version = version[version.find("=")+1:]
+ version = version.replace("\n", " ").replace("=", " ")
+
+ if version.startswith("0"):
+ version = "Beta " + version
+
+ # get commitid using git command, a bit hacky but works
+ commitid = check_output(["git", "rev-parse", "HEAD"]).decode()
+
context = {"version": version, "commitid": commitid}
return render(request, 'client/about.html', context)
diff --git a/version.txt b/version.txt
index 3b04cfb..c406ae0 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1,2 @@
-0.2
+version=0.2
+rev=1