Django

Code

Changeset 6840

Show
Ignore:
Timestamp:
12/02/07 12:32:23 (1 year ago)
Author:
jkocherhans
Message:

newforms-admin: Small cleanup of a bunch of _get_pk_val() calls.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin/django/newforms/models.py

    r6839 r6840  
    145145            yield (u"", self.empty_label) 
    146146        for obj in self.queryset: 
    147             yield (obj._get_pk_val(), smart_unicode(obj)) 
     147            yield (obj.pk, smart_unicode(obj)) 
    148148        # Clear the QuerySet cache if required. 
    149149        if not self.cache_choices: 
     
    267267        if isinstance(f, ManyToManyField): 
    268268            # MultipleChoiceWidget needs a list of ints, not object instances. 
    269             initial[f.name] = [obj._get_pk_val() for obj in f.value_from_object(instance)] 
     269            initial[f.name] = [obj.pk for obj in f.value_from_object(instance)] 
    270270        else: 
    271271            initial[f.name] = f.value_from_object(instance) 
     
    305305        existing_objects = {} 
    306306        for obj in self.queryset: 
    307             existing_objects[obj._get_pk_val()] = obj 
     307            existing_objects[obj.pk] = obj 
    308308        saved_instances = [] 
    309309        for form in self.change_forms: 
     
    368368 
    369369    def save_new(self, form, commit=True): 
    370         kwargs = {self.fk.get_attname(): self.instance.pk
     370        kwargs = {self.fk.get_attname(): self.instance._get_pk_val()
    371371        new_obj = self.model(**kwargs) 
    372372        return save_instance(form, new_obj, commit=commit)