Python django.views.generic.edit.FormView() Examples

The following are 2 code examples of django.views.generic.edit.FormView(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.views.generic.edit , or try the search function .
Example #1
Source File: view_partials.py    From callisto-core with GNU Affero General Public License v3.0 5 votes vote down vote up
def get_context_data(self, **kwargs):
        # IMPORTANT! this super call cannot be reduced to super()
        # TODO: add a test that fails with super()
        context = super(edit_views.FormView, self).get_context_data(**kwargs)
        current_site = self.request.site
        context.update(
            {
                self.redirect_field_name: self.get_redirect_url(),
                "site": current_site,
                "site_name": current_site.name,
            }
        )
        if self.extra_context is not None:
            context.update(self.extra_context)
        return context 
Example #2
Source File: views.py    From devops with MIT License 5 votes vote down vote up
def get_form_class(self):
        # @@@ django: this is a workaround to not having a dedicated method
        # to initialize self with a request in a known good state (of course
        # this only works with a FormView)
        self.primary_email_address = self.request.user.email
        return super(SettingsView, self).get_form_class()