Commits

Andy Mikhailenko committed 4b4493d

Add more docstrings for the stuff to appear in docs

Comments (0)

Files changed (6)

 
 
 class BaseEntityAdmin(ModelAdmin):
+    """ Base class for entity admin classes.
+    """
     eav_fieldsets = None
 
     def render_change_form(self, request, context, **kwargs):
 
 
 class BaseSchemaAdmin(ModelAdmin):
-
+    """ Base class for schema admin classes.
+    """
     list_display = ('title', 'name', 'datatype', 'help_text', 'required')
     prepopulated_fields = {'name': ('title',)}
 
 
 
 class Facet(object):
+    """ Base class for facets.  Concrete facets must overload at least the
+    `field_class` attribute.
+    """
     def __init__(self, facet_set, schema=None, field=None, lookup_prefix=''):
         self.facet_set = facet_set
         assert schema or field, 'Facet must be created with schema or field'
 
 
 class MultiTextFacet(TextFacet):
-    """
-    Represents a text field or schema. Allows multiple choices.
-    """
+    "Represents a text field or schema. Allows multiple choices."
     field_class = forms.MultipleChoiceField
     widget = forms.CheckboxSelectMultiple
 
 
 
 class ManyToManyFacet(Facet):
+    "Represents a many-to-many field."
     field_class = forms.models.ModelMultipleChoiceField
 
     def _get_queryset(self):
         return {'%s__in' % self.lookup_name: value} if value else {}
 
 class OneToManyFacet(Facet):
+    "Represents a one-to-many field."
     field_class = forms.models.ModelChoiceField
 
     def _get_queryset(self):
 
 
 class IntegerFacet(Facet):
+    "Represents an integer field."
     field_class = forms.IntegerField
 
 
 class RangeFacet(Facet):
-    """
-    A simple range facet: two widgets, one attribute value (number).
-    """
+    "A simple range facet: two widgets, one attribute value (number)."
     field_class = RangeField
 
     def get_lookups(self, value):
 
 
 class MultiRangeFacet(Facet):
-    """
-    A complex range facet: two widgets, two attribute values (numbers).
-    """
+    "A complex range facet: two widgets, two attribute values (numbers)."
     field_class = RangeField
 
     def get_lookups(self, value):
 
 
 class DateFacet(Facet):
+    "Represents a date field."
     field_class = forms.DateField
 
 
 class BooleanFacet(Facet):
+    "Represents a boolean field."
     field_class = forms.NullBooleanField
 
     # XXX this is funny but using RadioSelect for booleans is non-trivial
 
 
 class BaseFacetSet(object):
+    """ Base class for facet sets.  Concrete classes must overload at least
+    the `get_queryset` attribute.
+    """
     filterable_fields = []
     sortable_fields = []
     custom_facets = {}
 
 
 class RangeField(forms.MultiValueField):
+    "A multi-value field which consists of tho float fields."
     widget = RangeWidget
 
     def __init__(self, *args, **kwargs):
 
 
 class BaseSchemaForm(ModelForm):
+    """ Base class for schema forms.
+    """
 
     def clean_name(self):
         "Avoid name clashes between static and dynamic attributes."
 
 
 class BaseChoice(Model):
+    """ Base class for choices.  Concrete choice class must overload the
+    `schema` attribute.
+    """
     title = CharField(max_length=100)
     schema = NotImplemented
 
 
 
 class BaseAttribute(Model):
+    """ Base class for choices.  Concrete choice class must overload the
+    `schema` and `choice` attributes.
+    """
     entity_type = ForeignKey(ContentType)
     entity_id = IntegerField()
     entity = generic.GenericForeignKey(ct_field="entity_type", fk_field='entity_id')
 
 
 class RangeWidget(forms.MultiWidget):
+    "Represents a range of numbers."
+
     def __init__(self, attrs=None):
         widgets = (forms.TextInput(attrs=attrs), forms.TextInput(attrs=attrs))
         attrs = attrs or {}