Ticket #7730: unused_code_nfa.diff
File unused_code_nfa.diff, 3.8 KB (added by , 16 years ago) |
---|
-
django/contrib/admin/options.py
1 from django import oldforms,template1 from django import template 2 2 from django import newforms as forms 3 3 from django.newforms.formsets import all_valid 4 4 from django.newforms.models import modelform_factory, inlineformset_factory … … 257 257 # Check that LogEntry, ContentType and the auth context processor are installed. 258 258 from django.conf import settings 259 259 if settings.DEBUG: 260 from django.contrib.contenttypes.models import ContentType261 260 from django.contrib.admin.models import LogEntry 262 261 if not LogEntry._meta.installed: 263 262 raise ImproperlyConfigured("Put 'django.contrib.admin' in your INSTALLED_APPS setting in order to use the admin application.") … … 492 491 "The 'add' admin view for this model." 493 492 model = self.model 494 493 opts = model._meta 495 app_label = opts.app_label496 494 497 495 if not self.has_add_permission(request): 498 496 raise PermissionDenied 499 497 500 if self.has_change_permission(request, None):501 # redirect to list view502 post_url = '../'503 else:504 # Object list will give 'Permission Denied', so go back to admin home505 post_url = '../../../'506 507 498 ModelForm = self.get_form(request) 508 499 inline_formsets = [] 509 500 obj = self.model() … … 549 540 "The 'change' admin view for this model." 550 541 model = self.model 551 542 opts = model._meta 552 app_label = opts.app_label553 543 554 544 try: 555 545 obj = model._default_manager.get(pk=object_id) -
django/contrib/admin/views/main.py
5 5 from django.db.models.query import QuerySet 6 6 from django.utils.encoding import force_unicode, smart_str 7 7 from django.utils.translation import ugettext 8 from django.utils.safestring import mark_safe9 8 from django.utils.http import urlencode 10 9 import operator 11 10 -
django/contrib/admin/widgets.py
7 7 from django import newforms as forms 8 8 from django.newforms.widgets import RadioFieldRenderer 9 9 from django.newforms.util import flatatt 10 from django.utils.datastructures import MultiValueDict 11 from django.utils.text import capfirst, truncate_words 10 from django.utils.text import truncate_words 12 11 from django.utils.translation import ugettext as _ 13 12 from django.utils.safestring import mark_safe 14 13 from django.utils.encoding import force_unicode … … 27 26 super(FilteredSelectMultiple, self).__init__(attrs, choices) 28 27 29 28 def render(self, name, value, attrs=None, choices=()): 30 from django.conf import settings31 29 output = [super(FilteredSelectMultiple, self).render(name, value, attrs, choices)] 32 30 output.append(u'<script type="text/javascript">addEvent(window, "load", function(e) {') 33 31 # TODO: "id_" is hard-coded here. This should instead use the correct … … 103 101 super(ForeignKeyRawIdWidget, self).__init__(attrs) 104 102 105 103 def render(self, name, value, attrs=None): 106 from django.conf import settings107 104 related_url = '../../../%s/%s/' % (self.rel.to._meta.app_label, self.rel.to._meta.object_name.lower()) 108 105 if self.rel.limit_choices_to: 109 106 url = '?' + '&'.join(['%s=%s' % (k, v) for k, v in self.rel.limit_choices_to.items()])