Ticket #7730: unused_code_nfa.diff

File unused_code_nfa.diff, 3.8 KB (added by slonopotamus, 7 years ago)

unused_code_nfa.diff

  • django/contrib/admin/options.py

     
    1 from django import oldforms, template
     1from django import template
    22from django import newforms as forms
    33from django.newforms.formsets import all_valid
    44from django.newforms.models import modelform_factory, inlineformset_factory
     
    257257        # Check that LogEntry, ContentType and the auth context processor are installed.
    258258        from django.conf import settings
    259259        if settings.DEBUG:
    260             from django.contrib.contenttypes.models import ContentType
    261260            from django.contrib.admin.models import LogEntry
    262261            if not LogEntry._meta.installed:
    263262                raise ImproperlyConfigured("Put 'django.contrib.admin' in your INSTALLED_APPS setting in order to use the admin application.")
     
    492491        "The 'add' admin view for this model."
    493492        model = self.model
    494493        opts = model._meta
    495         app_label = opts.app_label
    496494
    497495        if not self.has_add_permission(request):
    498496            raise PermissionDenied
    499497
    500         if self.has_change_permission(request, None):
    501             # redirect to list view
    502             post_url = '../'
    503         else:
    504             # Object list will give 'Permission Denied', so go back to admin home
    505             post_url = '../../../'
    506 
    507498        ModelForm = self.get_form(request)
    508499        inline_formsets = []
    509500        obj = self.model()
     
    549540        "The 'change' admin view for this model."
    550541        model = self.model
    551542        opts = model._meta
    552         app_label = opts.app_label
    553543
    554544        try:
    555545            obj = model._default_manager.get(pk=object_id)
  • django/contrib/admin/views/main.py

     
    55from django.db.models.query import QuerySet
    66from django.utils.encoding import force_unicode, smart_str
    77from django.utils.translation import ugettext
    8 from django.utils.safestring import mark_safe
    98from django.utils.http import urlencode
    109import operator
    1110
  • django/contrib/admin/widgets.py

     
    77from django import newforms as forms
    88from django.newforms.widgets import RadioFieldRenderer
    99from django.newforms.util import flatatt
    10 from django.utils.datastructures import MultiValueDict
    11 from django.utils.text import capfirst, truncate_words
     10from django.utils.text import truncate_words
    1211from django.utils.translation import ugettext as _
    1312from django.utils.safestring import mark_safe
    1413from django.utils.encoding import force_unicode
     
    2726        super(FilteredSelectMultiple, self).__init__(attrs, choices)
    2827
    2928    def render(self, name, value, attrs=None, choices=()):
    30         from django.conf import settings
    3129        output = [super(FilteredSelectMultiple, self).render(name, value, attrs, choices)]
    3230        output.append(u'<script type="text/javascript">addEvent(window, "load", function(e) {')
    3331        # TODO: "id_" is hard-coded here. This should instead use the correct
     
    103101        super(ForeignKeyRawIdWidget, self).__init__(attrs)
    104102
    105103    def render(self, name, value, attrs=None):
    106         from django.conf import settings
    107104        related_url = '../../../%s/%s/' % (self.rel.to._meta.app_label, self.rel.to._meta.object_name.lower())
    108105        if self.rel.limit_choices_to:
    109106            url = '?' + '&amp;'.join(['%s=%s' % (k, v) for k, v in self.rel.limit_choices_to.items()])
Back to Top