Ticket #1300: housekeeping2.diff

File housekeeping2.diff, 15.6 KB (added by Esaj, 19 years ago)

Removed diff for contenttypes

  • django/contrib/admin/templatetags/log.py

     
    1313    def render(self, context):
    1414        if self.user is not None and not self.user.isdigit():
    1515            self.user = context[self.user].id
    16         context[self.varname] = LogEntry.objects.get_list(user__id__exact=self.user,
    17             limit=self.limit, select_related=True)
     16        context[self.varname] = LogEntry.objects.filter(user__id__exact=self.user).select_related()[:self.limit]
    1817        return ''
    1918
    2019class DoGetAdminLog:
  • django/contrib/admin/filterspecs.py

     
    5656            self.lookup_title = f.verbose_name
    5757        self.lookup_kwarg = '%s__%s__exact' % (f.name, f.rel.to._meta.pk.name)
    5858        self.lookup_val = request.GET.get(self.lookup_kwarg, None)
    59         self.lookup_choices = f.rel.to._default_manager.get_list()
     59        self.lookup_choices = f.rel.to._default_manager.all()
    6060
    6161    def has_output(self):
    6262        return len(self.lookup_choices) > 1
  • django/contrib/admin/views/decorators.py

     
    7171        # Check the password.
    7272        username = request.POST.get('username', '')
    7373        try:
    74             user = User.objects.get_object(username__exact=username, is_staff__exact=True)
     74            user = User.objects.get(username=username, is_staff=True)
    7575        except User.DoesNotExist:
    7676            message = ERROR_MESSAGE
    7777            if '@' in username:
    7878                # Mistakenly entered e-mail address instead of username? Look it up.
    7979                try:
    80                     user = User.objects.get_object(email__exact=username)
     80                    user = User.objects.get(email=username)
    8181                except User.DoesNotExist:
    8282                    message = _("Usernames cannot contain the '@' character.")
    8383                else:
  • django/contrib/admin/views/doc.py

     
    103103                'name': func.__name__,
    104104                'module': func.__module__,
    105105                'site_id': settings_mod.SITE_ID,
    106                 'site': Site.objects.get_object(pk=settings_mod.SITE_ID),
     106                'site': Site.objects.get(pk=settings_mod.SITE_ID),
    107107                'url': simplify_regex(regex),
    108108            })
    109109    return render_to_response('admin_doc/view_index', {'views': views}, context_instance=RequestContext(request))
     
    206206                'exists': os.path.exists(template_file),
    207207                'contents': lambda: os.path.exists(template_file) and open(template_file).read() or '',
    208208                'site_id': settings_mod.SITE_ID,
    209                 'site': Site.objects.get_object(pk=settings_mod.SITE_ID),
     209                'site': Site.objects.get(pk=settings_mod.SITE_ID),
    210210                'order': list(settings_mod.TEMPLATE_DIRS).index(dir),
    211211            })
    212212    return render_to_response('admin_doc/template_detail', {
  • django/contrib/auth/handlers/modpython.py

     
    2121    superuser_only = _str_to_bool(options.get('DjangoRequireSuperuserStatus', "off"))
    2222
    2323    # check that the username is valid
    24     kwargs = {'username__exact': req.user, 'is_active__exact': True}
     24    kwargs = {'username': req.user, 'is_active': True}
    2525    if staff_only:
    26         kwargs['is_staff__exact'] = True
     26        kwargs['is_staff'] = True
    2727    if superuser_only:
    28         kwargs['is_superuser__exact'] = True
     28        kwargs['is_superuser'] = True
    2929    try:
    30         user = User.objects.get_object(**kwargs)
     30        user = User.objects.get(**kwargs)
    3131    except User.DoesNotExist:
    3232        return apache.HTTP_UNAUTHORIZED
    3333
  • django/contrib/auth/models.py

     
    183183
    184184    def get_and_delete_messages(self):
    185185        messages = []
    186         for m in self.get_message_list():
     186        for m in self.message_set.all():
    187187            messages.append(m.message)
    188188            m.delete()
    189189        return messages
     
    205205            try:
    206206                app, mod = settings.AUTH_PROFILE_MODULE.split('.')
    207207                module = __import__('ellington.%s.apps.%s' % (app, mod), [], [], [''])
    208                 self._profile_cache = module.get_object(user_id=self.id)
     208                self._profile_cache = module.get(user_id=self.id)
    209209            except ImportError:
    210210                try:
    211211                    module = __import__('django.models.%s' % settings.AUTH_PROFILE_MODULE, [], [], [''])
    212                     self._profile_cache = module.get_object(user__id__exact=self.id)
     212                    self._profile_cache = module.get(user__id__exact=self.id)
    213213                except ImportError:
    214214                    raise SiteProfileNotAvailable
    215215        return self._profile_cache
  • django/core/handlers/wsgi.py

     
    126126                user_id = self.session[SESSION_KEY]
    127127                if not user_id:
    128128                    raise ValueError
    129                 self._user = User.objects.get_object(pk=user_id)
     129                self._user = User.objects.get(pk=user_id)
    130130            except (AttributeError, KeyError, ValueError, User.DoesNotExist):
    131131                from django.parts.auth import anonymoususers
    132132                self._user = anonymoususers.AnonymousUser()
  • django/core/handlers/modpython.py

     
    105105                user_id = self.session[SESSION_KEY]
    106106                if not user_id:
    107107                    raise ValueError
    108                 self._user = User.objects.get_object(pk=user_id)
     108                self._user = User.objects.get(pk=user_id)
    109109            except (AttributeError, KeyError, ValueError, User.DoesNotExist):
    110110                from django.parts.auth import anonymoususers
    111111                self._user = anonymoususers.AnonymousUser()
  • django/core/management.py

     
    559559    num_added = 0
    560560    app_models = get_models(app)
    561561    app_label = app_models[0]._meta.app_label
    562     package = Package.objects.get_object(pk=app_label)
     562    package = Package.objects.get(pk=app_label)
    563563    for klass in app_models:
    564564        opts = klass._meta
    565565        for codename, name in _get_all_permissions(opts):
    566566            try:
    567                 Permission.objects.get_object(name__exact=name, codename__exact=codename, package__label__exact=package.label)
     567                Permission.objects.get(name=name, codename=codename, package__label__exact=package.label)
    568568            except Permission.DoesNotExist:
    569569                p = Permission(name=name, package=package, codename=codename)
    570570                p.save()
     
    644644                sys.stderr.write("Error: That username is invalid.\n")
    645645                username = None
    646646            try:
    647                 User.objects.get_object(username__exact=username)
     647                User.objects.get(username=username)
    648648            except User.DoesNotExist:
    649649                break
    650650            else:
  • django/core/paginator.py

     
    1616    Finally, check if a page number has a next/prev page using
    1717    has_next_page(page_number) and has_previous_page(page_number).
    1818    """
    19     def __init__(self, manager_or_model, args, num_per_page, count_method='get_count', list_method='get_list'):
     19    def __init__(self, manager_or_model, args, num_per_page, count_method='count', list_method='all'):
    2020        if hasattr(manager_or_model, '_default_manager'):
    2121            manager = manager_or_model._default_manager
    2222        else:
  • django/db/models/fields/__init__.py

     
    256256            return first_choice + list(self.choices)
    257257        rel_model = self.rel.to
    258258        return first_choice + [(x._get_pk_val(), str(x))
    259                                for x in rel_model._default_manager.get_list(**rel_model._meta.limit_choices_to)]
     259                               for x in rel_model._default_manager.filter(**rel_model._meta.limit_choices_to)]
    260260
    261261    def get_choices_default(self):
    262262        if self.radio_admin:
  • django/db/models/options.py

     
    8787        "Returns the content-type ID for this object type."
    8888        if not hasattr(self, '_content_type_id'):
    8989            from django.contrib.contenttypes.models import ContentType
    90             self._content_type_id = ContentType.objects.get_object(
     90            self._content_type_id = ContentType.objects.get(
    9191                python_module_name__exact=self.module_name,
    9292                package__label__exact=self.app_label).id
    9393        return self._content_type_id
  • django/db/models/manipulators.py

     
    250250    def __init__(self, obj_key, follow=None):
    251251        self.obj_key = obj_key
    252252        try:
    253             self.original_object = self.manager.get_object(pk=obj_key)
     253            self.original_object = self.manager.get(pk=obj_key)
    254254        except ObjectDoesNotExist:
    255255            # If the object doesn't exist, this might be a manipulator for a
    256256            # one-to-one related object that hasn't created its subobject yet.
  • django/parts/auth/formfields.py

     
    2929
    3030    def isValidUser(self, field_data, all_data):
    3131        try:
    32             self.user_cache = User.objects.get_object(username__exact=field_data)
     32            self.user_cache = User.objects.get(username=field_data)
    3333        except User.DoesNotExist:
    3434            raise validators.ValidationError, _("Please enter a correct username and password. Note that both fields are case-sensitive.")
    3535
  • django/contrib/redirects/middleware.py

     
    88            return response # No need to check for a redirect for non-404 responses.
    99        path = request.get_full_path()
    1010        try:
    11             r = Redirect.objects.get_object(site__id__exact=settings.SITE_ID, old_path__exact=path)
     11            r = Redirect.objects.get(site__id__exact=settings.SITE_ID, old_path__exact=path)
    1212        except Redirect.DoesNotExist:
    1313            r = None
    1414        if r is None and settings.APPEND_SLASH:
    1515            # Try removing the trailing slash.
    1616            try:
    17                 r = Redirect.objects.get_object(site__id__exact=settings.SITE_ID,
    18                     old_path__exact=path[:path.rfind('/')]+path[path.rfind('/')+1:])
     17                r = Redirect.objects.get(site__id__exact=settings.SITE_ID,
     18                    old_path=path[:path.rfind('/')]+path[path.rfind('/')+1:])
    1919            except Redirect.DoesNotExist:
    2020                pass
    2121        if r is not None:
  • django/contrib/sessions/middleware.py

     
    4646                self._session_cache = {}
    4747            else:
    4848                try:
    49                     s = Session.objects.get_object(session_key__exact=self.session_key,
     49                    s = Session.objects.get(session_key=self.session_key,
    5050                        expire_date__gt=datetime.datetime.now())
    5151                    self._session_cache = s.get_decoded()
    5252                except Session.DoesNotExist:
  • django/contrib/sessions/models.py

     
    1818        while 1:
    1919            session_key = md5.new(str(random.randint(0, sys.maxint - 1)) + str(random.randint(0, sys.maxint - 1)) + settings.SECRET_KEY).hexdigest()
    2020            try:
    21                 self.get_object(session_key__exact=session_key)
    22             except self.klass.DoesNotExist:
     21                self.get(session_key=session_key)
     22            except self.model.DoesNotExist:
    2323                break
    2424        return session_key
    2525
    2626    def save(self, session_key, session_dict, expire_date):
    27         s = self.klass(session_key, self.encode(session_dict), expire_date)
     27        s = self.model(session_key, self.encode(session_dict), expire_date)
    2828        if session_dict:
    2929            s.save()
    3030        else:
  • django/shortcuts/__init__.py

     
    1212
    1313def get_object_or_404(klass, **kwargs):
    1414    try:
    15         return klass._default_manager.get_object(**kwargs)
     15        return klass._default_manager.get(**kwargs)
    1616    except klass.DoesNotExist:
    1717        raise Http404
    1818
  • django/contrib/sites/models.py

     
    44class SiteManager(models.Manager):
    55    def get_current(self):
    66        from django.conf import settings
    7         return self.get_object(pk=settings.SITE_ID)
     7        return self.get(pk=settings.SITE_ID)
    88
    99class Site(models.Model):
    1010    domain = models.CharField(_('domain name'), maxlength=100)
  • django/contrib/syndication/feeds.py

     
    4646        """
    4747        if url:
    4848            try:
    49                 obj = self.get_object(url.split('/'))
     49                obj = self.get(url.split('/'))
    5050            except (AttributeError, ObjectDoesNotExist):
    5151                raise FeedDoesNotExist
    5252        else:
Back to Top