def create_data(request): #u_form = User.AdminForm user_form = User.AdminForm(request.POST) if user_form.is_valid(): user = User() user.create_user(user_form.cleaned_data['username'], user_form.cleaned_data['password'], user_form.cleaned_data['email']) #user = User(username=user_form.cleaned_data['username']) #user.is_superuser = True #user.is_staff = True #user.save() #s_form = GeneralSettings.AdminForm settings_form = GeneralSettings.AdminForm(request.POST) if settings_form.is_valid(): settings = GeneralSettings(**settings_form.cleaned_data) settings.save() create_menu() return HttpResponseRedirect(reverse('dashboard'))
def handle(self, **kwargs): site_title = self._get_string('Site Title') tagline = self._get_string('Site Tagline', required=False) site_url = self._get_string('Site URL') footer_text = self._get_string('Set you site footer text') settings = GeneralSettings(site_title=site_title) settings.tagline = tagline settings.site_url = site_url settings.footer_text = footer_text settings.save() print 'Setting for site "%s" successfully added' % site_title