Skip to content
Snippets Groups Projects
Commit 4a4c85b2 authored by Flavio TARSETTI's avatar Flavio TARSETTI
Browse files

[plotters][models/serializers/templates] added plotter description/short

description update capacity.
- Added documentation editor
- Force editor to be uneditable(False) when not plotterparameter is private
- Added get_api_update_url for documentation update
- Using django smart encoding for descriptions
parent 598fb7d7
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -286,6 +286,14 @@ class PlotterParameter(Contribution):
)
def get_api_update_url(self):
'''Returns the endpoint to update this object'''
return reverse(
'api_plotters:view',
args=(self.author.username, self.name, self.version,),
)
......
......@@ -33,6 +33,7 @@ from ..code.serializers import CodeSerializer, CodeCreationSerializer
from ..libraries.serializers import LibraryReferenceSerializer
from ..dataformats.serializers import ReferencedDataFormatSerializer
from django.utils.encoding import smart_unicode, smart_str
import beat.core.plotter
import simplejson as json
......@@ -160,7 +161,6 @@ class PlotterParameterAllSerializer(ContributionSerializer):
#----------------------------------------------------------
class FullPlotterParameterSerializer(PlotterParameterAllSerializer):
plotters = serializers.SerializerMethodField()
......@@ -170,6 +170,12 @@ class FullPlotterParameterSerializer(PlotterParameterAllSerializer):
#default_fields = PlotterParameterAllSerializer.Meta.default_fields + PlotterParameterAllSerializer.Meta.extra_fields
default_fields = ['id', 'accessibility', 'modifiable', 'deletable', 'is_owner', 'name', 'fork_of', 'last_version', 'previous_version', 'short_description', 'description', 'version', 'creation_date', 'data', 'plotter', 'plotters']
def get_description(self, obj):
return smart_unicode(obj.description, encoding='utf-8', strings_only=False, errors='strict')
def get_short_description(self, obj):
return smart_unicode(obj.short_description, encoding='utf-8', strings_only=False, errors='strict')
def get_data(self, obj):
return json.loads(obj.data)
......
......@@ -148,7 +148,7 @@
{% plotterparameter_sampleplot plotterparameter %}
</div>
<div role="tabpanel" class="tab-pane" id="doc">
{% doc_editor plotterparameter 'api_plotterparameters:object' %}
{% doc_editor plotterparameter 'api_plotterparameters:object' False %}
</div>
{% if owner %}
<div role="tabpanel" class="tab-pane" id="sharing">
......@@ -235,7 +235,10 @@
</div>
<div role="tabpanel" class="tab-pane" id="doc">
{%comment%}
{% doc_editor plotterparameter 'api_plotterparameters:object' %}
{%endcomment%}
{% doc_editor plotterparameter 'api_plotters:all' %}
</div>
{% if owner %}
<div role="tabpanel" class="tab-pane" id="sharing">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment