Django

Code

Changeset 1175

Show
Ignore:
Timestamp:
11/11/05 12:10:36 (3 years ago)
Author:
rjwittams
Message:

Merged to trunk r1174, some other fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/new-admin/django/bin/django-admin.py

    r1070 r1175  
    7878        action = args[0] 
    7979    except IndexError: 
    80         print_error("An action is required.", sys.argv[0]
     80        parser.print_usage_and_exit(
    8181    if not ACTION_MAPPING.has_key(action): 
    8282        print_error("Your action, %r, was invalid." % action, sys.argv[0]) 
  • django/branches/new-admin/django/contrib/admin/templatetags/admin_list.py

    r1159 r1175  
    156156            # For non-field list_display values, the value is a method 
    157157            # name. Execute the method. 
     158            func = getattr(result, field_name) 
    158159            try: 
    159                 result_repr = strip_tags(str(getattr(result, field_name)())) 
     160                result_repr = str(func()) 
    160161            except ObjectDoesNotExist: 
    161162                result_repr = EMPTY_CHANGELIST_VALUE 
     163            else: 
     164                # Strip HTML tags in the resulting text, except if the  
     165                # function has an "allow_tags" attribute set to True.  
     166                if not getattr(func, 'allow_tags', False):  
     167                    result_repr = strip_tags(result_repr) 
    162168        else: 
    163169            field_val = getattr(result, f.attname) 
  • django/branches/new-admin/django/contrib/admin/templatetags/admin_modify.py

    r1169 r1175  
    3131    has_delete_permission = context['has_delete_permission'] 
    3232    is_popup = context['is_popup'] 
    33     print is_popup.something 
    3433    return { 
    3534        'onclick_attrib' : (bound_manipulator.ordered_objects and change  
  • django/branches/new-admin/django/core/meta/__init__.py

    r1160 r1175  
    266266 
    267267    def get_method_name_part(self): 
    268         return self.parent_opts.get_rel_object_method_name(self.opts, self.field) 
     268        # This method encapsulates the logic that decides what name to give a 
     269        # method that retrieves related many-to-one objects. Usually it just 
     270        # uses the lower-cased object_name, but if the related object is in 
     271        # another app, its app_label is appended. 
     272        # 
     273        # Examples: 
     274        # 
     275        #   # Normal case -- a related object in the same app. 
     276        #   # This method returns "choice". 
     277        #   Poll.get_choice_list() 
     278        # 
     279        #   # A related object in a different app. 
     280        #   # This method returns "lcom_bestofaward". 
     281        #   Place.get_lcom_bestofaward_list() # "lcom_bestofaward" 
     282        rel_obj_name = self.field.rel.related_name or self.opts.object_name.lower() 
     283        if self.parent_opts.app_label != self.opts.app_label: 
     284            rel_obj_name = '%s_%s' % (self.opts.app_label, rel_obj_name) 
     285        return rel_obj_name 
    269286 
    270287class Options: 
     
    387404    def get_delete_permission(self): 
    388405        return 'delete_%s' % self.object_name.lower() 
    389  
    390     def get_rel_object_method_name(self, rel_opts, rel_field): 
    391         # This method encapsulates the logic that decides what name to give a 
    392         # method that retrieves related many-to-one objects. Usually it just 
    393         # uses the lower-cased object_name, but if the related object is in 
    394         # another app, its app_label is appended. 
    395         # 
    396         # Examples: 
    397         # 
    398         #   # Normal case -- a related object in the same app. 
    399         #   # This method returns "choice". 
    400         #   Poll.get_choice_list() 
    401         # 
    402         #   # A related object in a different app. 
    403         #   # This method returns "lcom_bestofaward". 
    404         #   Place.get_lcom_bestofaward_list() # "lcom_bestofaward" 
    405         rel_obj_name = rel_field.rel.related_name or rel_opts.object_name.lower() 
    406         if self.app_label != rel_opts.app_label: 
    407             rel_obj_name = '%s_%s' % (rel_opts.app_label, rel_obj_name) 
    408         return rel_obj_name 
    409406 
    410407    def get_all_related_objects(self):