Hi Aptem,
Your questions is not clearly what exactly do you want, where are you stuck, specifically,
Check this it might assist you
https://docs.djangoproject.com/en/1.7/topics/forms/this is a very basic example if you have an organization mode below
models.py
class Organization(models.Model):
name = models.CharField(max_length=25)
create a forms module and add this
form.py
class NameForm(form.Form):
name = forms.CharField(max_length=25)
view.py
import the model and form to you view
def organization_save(request):
# if this is a POST request we need to process the form data
if request.method == 'POST':
# create a form instance and populate it with data from the request:
form = NameForm(request.POST)
# check whether it's valid:
if form.is_valid():
# process the data in form.cleaned_data as required
cleaned_name = form.cleaned_data['name']
# save form if its new organization creation
organization = Organization.objects.create(name=cleaned_name)
# if its an existing organizanization
organization = Organization.objects.get(id='the id of the organization')
organization .name = cleaned_name
organization .save()
# redirect to a new URL:
return HttpResponseRedirect('/thanks/')
# if a GET (or any other method) we'll create a blank form
else:
form = NameForm()
return render(request, 'name.html', {'form': form})