  
  
  def _form_to_data(form):
      """
      Returns a dict containing the data in a form instance.
      
      This code is pretty much a clone of the ``Form.as_p()`` ``Form.as_ul``
      and ``Form.as_table()`` methods, except that it returns data suitable
      for arbitrary serialization, rather than rendering the result directly
      into html.
      """
      ret = {}
      for name, field in form.fields.items():
          if not form.is_bound:
              data = form.initial.get(name, field.initial)
 
</s> remove def _form_to_data(form):
 </s> add class BaseResource(object): </s> remove     ret = {}
    for name, field in form.fields.items():
        if not form.is_bound:
            data = form.initial.get(name, field.initial)
            if callable(data):
                data = data()
        else:
            if isinstance(field, FileField) and form.data is None:
                data = form.initial.get(name, field.initial)
            else:
                data = field.widget.value_from_datadict(form.data, form.files, name)
        ret[name] = field.prepare_value(data)
    return ret


class BaseResource(object):
    """Base class for all Resource classes, which simply defines the interface they provide."""
 </s> add     fields = None
    include = None
    exclude = None </s> remove     This is a clone of Django's ``django.forms.model_to_dict`` except that it
    doesn't coerce related objects into primary keys.
 </s> add     Given a model instance, return a ``dict`` representing the model.
    
    The implementation is similar to Django's ``django.forms.model_to_dict``, except:

    * It doesn't coerce related objects into primary keys.
    * It doesn't drop ``editable=False`` fields.
    * It also supports attribute or method fields on the instance or resource. </s> remove def _model_to_dict(instance, fields=None, exclude=None):
 </s> add def _model_to_dict(instance, resource=None): </s> remove         """Returns a set containing the names of validated properties on the model."""
        resource = self.view.resource
        model = getattr(resource, 'model', None)
        fields = getattr(resource, 'fields', self.fields)
        exclude_fields = getattr(resource, 'exclude_fields', self.exclude_fields)

        property_fields = set(attr for attr in dir(model) if
                              isinstance(getattr(model, attr, None), property)
 </s> add         """
        Returns a set containing the names of validated properties on the model.
        """
        property_fields = set(attr for attr in dir(self.model) if
                              isinstance(getattr(self.model, attr, None), property)
    Base class for all Resource classes, which simply defines the interface they provide.
  
  
  def _form_to_data(form):
      """
    Base class for all Resource classes, which simply defines the interface they provide.
    Base class for all Resource classes, which simply defines the interface they provide.
    Base class for all Resource classes, which simply defines the interface they provide.
    Base class for all Resource classes, which simply defines the interface they provide.
    Base class for all Resource classes, which simply defines the interface they provide.
    Base class for all Resource classes, which simply defines the interface they provide.
      """
      ret = {}
      for name, field in form.fields.items():
          if not form.is_bound:
              data = form.initial.get(name, field.initial)
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
 Sorting out resources.  Doing some crazy magic automatic url resolving stuff.  Yum. 
djangorestframework/resources.py