~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to django/views/generic/edit.py

  • Committer: Package Import Robot
  • Author(s): Raphaël Hertzog
  • Date: 2014-09-17 14:15:11 UTC
  • mfrom: (1.3.17) (6.2.18 experimental)
  • Revision ID: package-import@ubuntu.com-20140917141511-icneokthe9ww5sk4
Tags: 1.7-2
* Release to unstable.
* Add a migrate-south sample script to help users apply their South
  migrations. Thanks to Brian May.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import warnings
2
2
 
 
3
from django.core.exceptions import ImproperlyConfigured
3
4
from django.forms import models as model_forms
4
 
from django.core.exceptions import ImproperlyConfigured
5
5
from django.http import HttpResponseRedirect
 
6
from django.utils.deprecation import RemovedInDjango18Warning
6
7
from django.utils.encoding import force_text
7
8
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
8
9
from django.views.generic.detail import (SingleObjectMixin,
113
114
            if self.fields is None:
114
115
                warnings.warn("Using ModelFormMixin (base class of %s) without "
115
116
                              "the 'fields' attribute is deprecated." % self.__class__.__name__,
116
 
                              PendingDeprecationWarning)
 
117
                              RemovedInDjango18Warning)
117
118
 
118
119
            return model_forms.modelform_factory(model, fields=self.fields)
119
120
 
122
123
        Returns the keyword arguments for instantiating the form.
123
124
        """
124
125
        kwargs = super(ModelFormMixin, self).get_form_kwargs()
125
 
        kwargs.update({'instance': self.object})
 
126
        if hasattr(self, 'object'):
 
127
            kwargs.update({'instance': self.object})
126
128
        return kwargs
127
129
 
128
130
    def get_success_url(self):