Ticket #7929: 7929.admin.cleanup.diff
File 7929.admin.cleanup.diff, 3.4 KB (added by , 16 years ago) |
---|
-
django/django/contrib/admin/options.py
462 462 "The 'add' admin view for this model." 463 463 model = self.model 464 464 opts = model._meta 465 app_label = opts.app_label466 465 467 466 if not self.has_add_permission(request): 468 467 raise PermissionDenied 469 468 470 if self.has_change_permission(request, None):471 # redirect to list view472 post_url = '../'473 else:474 # Object list will give 'Permission Denied', so go back to admin home475 post_url = '../../../'476 477 469 ModelForm = self.get_form(request) 478 470 inline_formsets = [] 479 471 obj = self.model() … … 519 511 "The 'change' admin view for this model." 520 512 model = self.model 521 513 opts = model._meta 522 app_label = opts.app_label523 514 524 515 try: 525 516 obj = model._default_manager.get(pk=object_id) -
django/django/contrib/admin/widgets.py
106 106 else: 107 107 url = '' 108 108 if not attrs.has_key('class'): 109 attrs['class'] = 'vForeignKeyRawIdAdminField' # The JavaScript looks for this hook.109 attrs['class'] = 'vForeignKeyRawIdAdminField' # The JavaScript looks for this hook. 110 110 output = [super(ForeignKeyRawIdWidget, self).render(name, value, attrs)] 111 111 # TODO: "id_" is hard-coded here. This should instead use the correct 112 112 # API to determine the ID dynamically. -
django/django/contrib/admin/sites.py
1 1 from django import http, template 2 2 from django.contrib.admin import ModelAdmin 3 3 from django.contrib.auth import authenticate, login 4 from django.core.exceptions import ImproperlyConfigured5 4 from django.db.models.base import ModelBase 6 5 from django.shortcuts import render_to_response 7 6 from django.utils.safestring import mark_safe … … 11 10 from django.conf import settings 12 11 import base64 13 12 import cPickle as pickle 14 import datetime15 13 import md5 16 14 import re 17 15 … … 27 25 pass 28 26 29 27 def _encode_post_data(post_data): 30 from django.conf import settings31 28 pickled = pickle.dumps(post_data) 32 29 pickled_md5 = md5.new(pickled + settings.SECRET_KEY).hexdigest() 33 30 return base64.encodestring(pickled + pickled_md5) 34 31 35 32 def _decode_post_data(encoded_data): 36 from django.conf import settings37 33 encoded_data = base64.decodestring(encoded_data) 38 34 pickled, tamper_check = encoded_data[:-32], encoded_data[-32:] 39 35 if md5.new(pickled + settings.SECRET_KEY).hexdigest() != tamper_check: … … 204 200 This takes into account the USE_I18N setting. If it's set to False, the 205 201 generated JavaScript will be leaner and faster. 206 202 """ 207 from django.conf import settings208 203 if settings.USE_I18N: 209 204 from django.views.i18n import javascript_catalog 210 205 else: