Ticket #5968: 5968-2.diff

File 5968-2.diff, 2.2 KB (added by Matt McClanahan, 16 years ago)

Add doc update

  • django/contrib/databrowse/sites.py

     
    11from django import http
    22from django.db import models
     3from django.db.models.base import ModelBase
    34from django.contrib.databrowse.datastructures import EasyModel
    45from django.shortcuts import render_to_response
    56from django.utils.safestring import mark_safe
     
    8586        If a model is already registered, this will raise AlreadyRegistered.
    8687        """
    8788        databrowse_class = databrowse_class or DefaultModelDatabrowse
    88         if issubclass(model_or_iterable, models.Model):
     89        if isinstance(model_or_iterable, ModelBase):
    8990            model_or_iterable = [model_or_iterable]
    9091        for model in model_or_iterable:
    9192            if model in self.registry:
     
    9899
    99100        If a model isn't already registered, this will raise NotRegistered.
    100101        """
    101         if issubclass(model_or_iterable, models.Model):
     102        if isinstance(model_or_iterable, ModelBase):
    102103            model_or_iterable = [model_or_iterable]
    103104        for model in model_or_iterable:
    104105            if model not in self.registry:
  • docs/ref/contrib/databrowse.txt

     
    4141    2. Register a number of models with the Databrowse site::
    4242
    4343           from django.contrib import databrowse
    44            from myapp.models import SomeModel, SomeOtherModel
     44           from myapp.models import SomeModel, SomeOtherModel, YetAnotherModel
    4545
    4646           databrowse.site.register(SomeModel)
    47            databrowse.site.register(SomeOtherModel)
     47           databrowse.site.register([SomeOtherModel, YetAnotherModel])
    4848
    4949       Note that you should register the model *classes*, not instances.
    5050
     51       The register function accepts an individual model class or a list of classes.
     52
    5153       It doesn't matter where you put this, as long as it gets executed at some
    5254       point. A good place for it is in your :ref:`URLconf file
    5355       <topics-http-urls>` (``urls.py``).
Back to Top