#Model from django.db import models from django.db import connection class MY_UTIL(): ''' Its pretty clean and nice way to define stored procedures inside the class, especially models.py (I hope someone will write a automatic generation for all stored procedure calls soon.) ''' def log_message(self, control_in, message_in): cursor = connection.cursor() ret = cursor.callproc("MY_UTIL.LOG_MESSAGE", (control_in, message_in))# calls PROCEDURE named LOG_MESSAGE which resides in MY_UTIL Package cursor.close() return ret #View from django import newform as form # here we are using newforms, please note its not available NOW in django standard package. class MessageForm(forms.Form): email = forms.EmailField(max_length=100, help_text="Please enter your email") subject = forms.CharField(max_length=50,help_text="Please provide a short desc") def message(request): if request.method == 'POST': form = MessageForm(request.POST) else: form = MessageForm() if form.is_valid(): my_util = MY_UTIL() ret = my_util.log_message(request.POST['email'], request.POST['subject']) return HttpResponseRedirect('/done/') return render_to_response('form.html', {'form':form})