mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 03:23:59 +03:00
fix typo in adding jquery string, update docs about detail page link for AdminRenderer
This commit is contained in:
parent
68312cb0bc
commit
b19865f88d
|
@ -187,6 +187,15 @@ This renderer is suitable for CRUD-style web APIs that should also present a use
|
|||
|
||||
Note that views that have nested or list serializers for their input won't work well with the `AdminRenderer`, as the HTML forms are unable to properly support them.
|
||||
|
||||
**Note**: To get proper links to detail page in `ListCreateAPIView` or `ListAPIView` you should implement `url` field in serializer which return correct link. For example here we use models `get_absolute_url` method:
|
||||
|
||||
class AccountSerializer(serializers.ModelSerializer):
|
||||
url = serializers.CharField(source='get_absolute_url', read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = Account
|
||||
|
||||
|
||||
**.media_type**: `text/html`
|
||||
|
||||
**.format**: `'.admin'`
|
||||
|
|
|
@ -219,7 +219,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% block script %}
|
||||
<script src="{% static "rest_framework/js/jquery-1.11.3-min.js" %}"></script>
|
||||
<script src="{% static "rest_framework/js/jquery-1.11.3.min.js" %}"></script>
|
||||
<script src="{% static "rest_framework/js/ajax-form.js" %}"></script>
|
||||
<script src="{% static "rest_framework/js/csrf.js" %}"></script>
|
||||
<script src="{% static "rest_framework/js/bootstrap.min.js" %}"></script>
|
||||
|
|
|
@ -7,14 +7,15 @@
|
|||
{% for row in results %}
|
||||
<tr>
|
||||
{% for key, value in row.items %}
|
||||
{% if key in columns %}
|
||||
<td {{ value|add_nested_class }} >
|
||||
{{ value|format_value }}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% if key in columns %}
|
||||
<td {{ value|add_nested_class }} >
|
||||
{{ value|format_value }}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<td><a href="{{ row.url }}"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||
</a></td>
|
||||
<td>
|
||||
<a href="{{ row.url }}"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue
Block a user