Ticket #1014: patch.diff

File patch.diff, 1.3 KB (added by django@…, 19 years ago)
  • C:/Program

     
    984984
    985985def method_save(opts, self):
    986986    # Run any pre-save hooks.
     987    cont = True
    987988    if hasattr(self, '_pre_save'):
    988         self._pre_save()
     989        cont = self._pre_save()
     990    #If function returned a value which is False stop saving
     991    if not cont and cont is not None:
     992        return
    989993    non_pks = [f for f in opts.fields if not f.primary_key]
    990994    cursor = db.db.cursor()
    991995
     
    10341038def method_delete(opts, self):
    10351039    assert getattr(self, opts.pk.attname) is not None, "%r can't be deleted because it doesn't have an ID."
    10361040    # Run any pre-delete hooks.
     1041    cont = True
    10371042    if hasattr(self, '_pre_delete'):
    1038         self._pre_delete()
     1043        cont = self._pre_delete()
     1044    #If function returned a value which is False stop saving
     1045    if not cont and cont is not None:
     1046        return
    10391047    cursor = db.db.cursor()
    10401048    for related in opts.get_all_related_objects():
    10411049        rel_opts_name = related.get_method_name_part()
Back to Top