diff options
Diffstat (limited to '')
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | client/views.py | 22 | ||||
-rw-r--r-- | version.txt | 3 |
3 files changed, 17 insertions, 9 deletions
@@ -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 |