from django.views.generic import TemplateView, FormView
from django.core.cache import cache
import forms


class Demo1View(FormView):
    template_name = 'jqmapp/demo1.html'
    form_class = forms.Demo1Form
    success_url = '/demo1/'

    def form_valid(self, form):
        cache.set('servo', form.cleaned_data['servo'])
        cache.set('led1', form.cleaned_data['led1'])
        cache.set('led2', form.cleaned_data['led2'])
        return super(Demo1View, self).form_valid(form)

    def get_initial(self):
        servo = cache.get('servo', 0)
        led1 = cache.get('led1')
        led2 = cache.get('led2')
        initial = {'servo': servo, 'led1': led1, 'led2': led2}
        return initial

d02242ebfb3a7a79c36c41a0b3b88384e2bc9dd2
<mask token>


class Demo1View(FormView):
    <mask token>
    <mask token>
    <mask token>

    def form_valid(self, form):
        cache.set('servo', form.cleaned_data['servo'])
        cache.set('led1', form.cleaned_data['led1'])
        cache.set('led2', form.cleaned_data['led2'])
        return super(Demo1View, self).form_valid(form)
    <mask token>

<mask token>


class Demo1View(FormView):
    <mask token>
    <mask token>
    <mask token>

    def form_valid(self, form):
        cache.set('servo', form.cleaned_data['servo'])
        cache.set('led1', form.cleaned_data['led1'])
        cache.set('led2', form.cleaned_data['led2'])
        return super(Demo1View, self).form_valid(form)

    def get_initial(self):
        servo = cache.get('servo', 0)
        led1 = cache.get('led1')
        led2 = cache.get('led2')
        initial = {'servo': servo, 'led1': led1, 'led2': led2}
        return initial

<mask token>


class Demo1View(FormView):
    template_name = 'jqmapp/demo1.html'
    form_class = forms.Demo1Form
    success_url = '/demo1/'

    def form_valid(self, form):
        cache.set('servo', form.cleaned_data['servo'])
        cache.set('led1', form.cleaned_data['led1'])
        cache.set('led2', form.cleaned_data['led2'])
        return super(Demo1View, self).form_valid(form)

    def get_initial(self):
        servo = cache.get('servo', 0)
        led1 = cache.get('led1')
        led2 = cache.get('led2')
        initial = {'servo': servo, 'led1': led1, 'led2': led2}
        return initial

from django.views.generic import TemplateView, FormView
from django.core.cache import cache
import forms


class Demo1View(FormView):
    template_name = 'jqmapp/demo1.html'
    form_class = forms.Demo1Form
    success_url = '/demo1/'

    def form_valid(self, form):
        cache.set('servo', form.cleaned_data['servo'])
        cache.set('led1', form.cleaned_data['led1'])
        cache.set('led2', form.cleaned_data['led2'])
        return super(Demo1View, self).form_valid(form)

    def get_initial(self):
        servo = cache.get('servo', 0)
        led1 = cache.get('led1')
        led2 = cache.get('led2')
        initial = {'servo': servo, 'led1': led1, 'led2': led2}
        return initial
