<commit_before>from django.views.generic.dates import DateDetailView, YearArchiveView, \
    ArchiveIndexView, DayArchiveView, WeekArchiveView, MonthArchiveView, \
    TodayArchiveView
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.views.generic.edit import FormView, CreateView, UpdateView, \
    DeleteView


__all__ = [
    'OctopusDetailView', 'OctopusListView', 'OctopusDateDetailView',
    'OctopusYearArchiveView', 'OctopusArchiveIndexView',
    'OctopusDayArchiveView', 'OctopusWeekArchiveView',
    'OctopusMonthArchiveView', 'OctopusTodayArchiveView', 'OctopusCreateView',
    'OctopusUpdateView', 'OctopusDeleteView']


class AjaxResponseMixin(object):
    fragment_name = None
    fragment_suffix = '_fragment'

    def get_template_names(self):

        if self.request.is_ajax():
            if self.fragment_name is not None:
                self.template_name = self.fragment_name
            self.template_name_suffix += self.fragment_suffix

        if hasattr(self.parent, "get_template_names"):
            return super(self.parent, self).get_template_names()

        return [self.template_name, "%s%s"
                % (self.template_name, self.template_name_suffix)]

views = (DetailView, ListView, DateDetailView, TodayArchiveView,
         DayArchiveView, WeekArchiveView, MonthArchiveView, YearArchiveView,
         ArchiveIndexView, FormView, CreateView, UpdateView, DeleteView)


# Inject AjaxResponseMixin into each view and tack "Octopus" on to the
# beginning of the class .
for view in views:
    name = 'Octopus%s' % view.__name__

    locals()[name] = type(name, (AjaxResponseMixin, view), {
        'parent': view
    })


'''edit_views = (FormView, CreateView, UpdateView, DeleteView)

for view in edit_views:
    name = 'Octopus%s' % view.__name__

    locals()[name] = type(name, (AjaxResponseMixin, view))
'''<commit_msg>Added Update view functionality with form template tags, templates, and tests.  Updated Readme<commit_after>from django.views.generic.dates import DateDetailView, YearArchiveView, \
    ArchiveIndexView, DayArchiveView, WeekArchiveView, MonthArchiveView, \
    TodayArchiveView
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.views.generic.edit import FormView, CreateView, UpdateView, \
    DeleteView


__all__ = [
    'OctopusDetailView', 'OctopusListView', 'OctopusDateDetailView',
    'OctopusYearArchiveView', 'OctopusArchiveIndexView',
    'OctopusDayArchiveView', 'OctopusWeekArchiveView',
    'OctopusMonthArchiveView', 'OctopusTodayArchiveView', 'OctopusCreateView',
    'OctopusUpdateView', 'OctopusDeleteView']


class AjaxResponseMixin(object):
    fragment_name = None
    fragment_suffix = '_fragment'

    def get_template_names(self):

        if self.request.is_ajax():
            if self.fragment_name is not None:
                self.template_name = self.fragment_name
            self.template_name_suffix += self.fragment_suffix

        if hasattr(self.parent, "get_template_names"):
            return super(self.parent, self).get_template_names()

        return [self.template_name, "%s%s"
                % (self.template_name, self.template_name_suffix)]

views = (DetailView, ListView, DateDetailView, TodayArchiveView,
         DayArchiveView, WeekArchiveView, MonthArchiveView, YearArchiveView,
         ArchiveIndexView, FormView, CreateView, UpdateView, DeleteView)


# Inject AjaxResponseMixin into each view and tack "Octopus" on to the
# beginning of the class .
for view in views:
    name = 'Octopus%s' % view.__name__

    locals()[name] = type(name, (AjaxResponseMixin, view), {
        'parent': view
    })
{'fraction_non_alphanumeric': 0.09502141327623126, 'fraction_numerical': 0.0, 'mean_word_length': 4.07055630936228, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7439279', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1054, 'n_words': 248}