mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 16:53:10 +00:00
Disable html_url if wagtail serve view is not registered
This commit is contained in:
parent
b391cbfd62
commit
c09059cc44
1 changed files with 10 additions and 2 deletions
|
|
@ -4,6 +4,8 @@ from collections import OrderedDict
|
|||
|
||||
from modelcluster.models import get_all_child_relations
|
||||
|
||||
from django.core.urlresolvers import NoReverseMatch
|
||||
|
||||
from taggit.managers import _TaggableManager
|
||||
|
||||
from rest_framework import serializers
|
||||
|
|
@ -61,12 +63,18 @@ class PageMetaField(MetaField):
|
|||
}
|
||||
"""
|
||||
def to_representation(self, page):
|
||||
return OrderedDict([
|
||||
data = OrderedDict([
|
||||
('type', page.specific_class._meta.app_label + '.' + page.specific_class.__name__),
|
||||
('detail_url', get_object_detail_url(self.context, type(page), page.pk)),
|
||||
('html_url', page.full_url),
|
||||
])
|
||||
|
||||
try:
|
||||
data['html_url'] = page.full_url
|
||||
except NoReverseMatch:
|
||||
pass
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class DocumentMetaField(MetaField):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue