diff options
| author | Tom Christie | 2014-10-02 18:13:15 +0100 | 
|---|---|---|
| committer | Tom Christie | 2014-10-02 18:13:15 +0100 | 
| commit | fec7c4b45812d22423e73ec3ab801857a55d7340 (patch) | |
| tree | 86a26d374d7b627c464841700988aa5ff4712ef3 | |
| parent | df7b6fcf58417fd95e49655eb140b387899b1ceb (diff) | |
| download | django-rest-framework-fec7c4b45812d22423e73ec3ab801857a55d7340.tar.bz2 | |
Browsable API tweaks
| -rw-r--r-- | rest_framework/fields.py | 5 | ||||
| -rw-r--r-- | rest_framework/relations.py | 1 | ||||
| -rw-r--r-- | rest_framework/serializers.py | 1 | ||||
| -rw-r--r-- | rest_framework/static/rest_framework/css/bootstrap-tweaks.css | 2 | ||||
| -rw-r--r-- | rest_framework/static/rest_framework/css/default.css | 3 | 
5 files changed, 6 insertions, 6 deletions
| diff --git a/rest_framework/fields.py b/rest_framework/fields.py index c794963e..3f22660c 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -106,7 +106,7 @@ class Field(object):          'null': _('This field may not be null.')      }      default_validators = [] -    default_empty_html = None +    default_empty_html = empty      initial = None      def __init__(self, read_only=False, write_only=False, @@ -375,7 +375,6 @@ class NullBooleanField(Field):      default_error_messages = {          'invalid': _('`{input}` is not a valid boolean.')      } -    default_empty_html = None      initial = None      TRUE_VALUES = set(('t', 'T', 'true', 'True', 'TRUE', '1', 1, True))      FALSE_VALUES = set(('f', 'F', 'false', 'False', 'FALSE', '0', 0, 0.0, False)) @@ -411,7 +410,6 @@ class CharField(Field):      default_error_messages = {          'blank': _('This field may not be blank.')      } -    default_empty_html = ''      initial = ''      def __init__(self, **kwargs): @@ -852,6 +850,7 @@ class MultipleChoiceField(ChoiceField):          'invalid_choice': _('`{input}` is not a valid choice.'),          'not_a_list': _('Expected a list of items but got type `{input_type}`')      } +    default_empty_html = []      def to_internal_value(self, data):          if isinstance(data, type('')) or not hasattr(data, '__iter__'): diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 988b9ede..4f971917 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -249,6 +249,7 @@ class ManyRelation(Field):      You shouldn't need to be using this class directly yourself.      """      initial = [] +    default_empty_html = []      def __init__(self, child_relation=None, *args, **kwargs):          self.child_relation = child_relation diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 0f24ed40..21cb7ea2 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -254,6 +254,7 @@ class Serializer(BaseSerializer):              return ReturnDict([                   (field_name, field.get_value(self._initial_data))                   for field_name, field in self.fields.items() +                 if field.get_value(self._initial_data) is not empty               ], serializer=self)              #return self.to_representation(self._initial_data) diff --git a/rest_framework/static/rest_framework/css/bootstrap-tweaks.css b/rest_framework/static/rest_framework/css/bootstrap-tweaks.css index 84389b1d..6a37cae2 100644 --- a/rest_framework/static/rest_framework/css/bootstrap-tweaks.css +++ b/rest_framework/static/rest_framework/css/bootstrap-tweaks.css @@ -173,7 +173,7 @@ footer a:hover {  .page-header {    border-bottom: none;    padding-bottom: 0px; -  margin-bottom: 20px; +  margin: 0;  }  /* custom general page styles */ diff --git a/rest_framework/static/rest_framework/css/default.css b/rest_framework/static/rest_framework/css/default.css index 461cdfe5..82c6033b 100644 --- a/rest_framework/static/rest_framework/css/default.css +++ b/rest_framework/static/rest_framework/css/default.css @@ -33,7 +33,7 @@ h2, h3 {  }  ul.breadcrumb { -  margin: 80px 0 0 0; +  margin: 70px 0 0 0;  }  form select, form input, form textarea { @@ -67,5 +67,4 @@ pre {  .page-header {    border-bottom: none;    padding-bottom: 0px; -  margin-bottom: 20px;  } | 
