diff --git a/ipynbsrv/core/models.py b/ipynbsrv/core/models.py index dfd6d67..2eb3827 100644 --- a/ipynbsrv/core/models.py +++ b/ipynbsrv/core/models.py @@ -571,7 +571,7 @@ def clone(self, name, description=None): return clone - def commit(self, name, description=None, public=False): + def commit(self, name, description=None, short_description=None, public=False): """ Create a new container image based on the container. @@ -581,6 +581,7 @@ def commit(self, name, description=None, public=False): """ image = ContainerImage( name=name, + short_description=short_description, description=description, command=self.image.command, protected_port=self.image.protected_port, @@ -781,8 +782,24 @@ class ContainerImage(models.Model): ) ] ) - description = models.TextField(blank=True, null=True) - # TODO: document placeholders + short_description = models.CharField( + blank=True, + null=True, + max_length=255, + help_text='A short description of the container image.' + ) + description = models.TextField( + blank=True, + null=True, + help_text='Detailed information on how to use this image.' + ) + access_groups = models.ManyToManyField( + 'CollaborationGroup', + blank=True, + related_name='images', + help_text='The groups having access to that image.' + ) + command = models.CharField( blank=True, null=True, diff --git a/ipynbsrv/web/templates/web/images/index.html b/ipynbsrv/web/templates/web/images/index.html index bfd9ebe..8a565d6 100644 --- a/ipynbsrv/web/templates/web/images/index.html +++ b/ipynbsrv/web/templates/web/images/index.html @@ -24,7 +24,7 @@

Images

Name - Description + Short Description Public Actions @@ -33,7 +33,7 @@

Images

{% for img in images %} {{ img.friendly_name }} - {{ img.description }} + {{ img.short_description }} diff --git a/ipynbsrv/web/templates/web/images/modal_create.html b/ipynbsrv/web/templates/web/images/modal_create.html index c321165..4fe629d 100644 --- a/ipynbsrv/web/templates/web/images/modal_create.html +++ b/ipynbsrv/web/templates/web/images/modal_create.html @@ -26,6 +26,10 @@

Allowed pattern: ^[A-z][\w\/]*$

+
+ + +
diff --git a/ipynbsrv/web/views/containers.py b/ipynbsrv/web/views/containers.py index 4c7fa63..99ccfe7 100644 --- a/ipynbsrv/web/views/containers.py +++ b/ipynbsrv/web/views/containers.py @@ -81,14 +81,19 @@ def commit(request): messages.error(request, "Invalid request method.") return redirect('images') if 'ct_id' not in request.POST or not request.POST.get('ct_id').isdigit() \ - or 'img_name' not in request.POST or 'description' not in request.POST: + or 'img_name' not in request.POST: messages.error(request, "Invalid POST request.") return redirect('images') params = {} ct_id = int(request.POST.get('ct_id')) params["name"] = request.POST.get('img_name') - params["description"] = request.POST.get('description') + description = request.POST.get('description', None) + if description: + params["description"] = description + short_description = request.POST.get('short_description', None) + if short_description: + params["short_description"] = short_description params["public"] = request.POST.get('public', "") == "on" client = get_httpclient_instance(request)