Thanks again dallas and kenneth,
Kenneth's comment about the clean process sent me back to the docs. I
was using form.cleaned_data to do my own integrity checking, but I
didn't realize what was truly available from the clean methods.
Handling the validation with custom form methods does seem
I believe this is a postgres thing -- the transaction failed but
postgres didn't rollback, and the message_set.create tries to put a
message in the database. it's kind of ghetto, but you can also try
manually rolling back postgres when you catch the exception but before
you set the message.
On 21-Apr-08, at 6:42 AM, radioflyer wrote:
> I've decided to manually check for uniqueness after form validation
> and before saving, and that seems to work fine for now.
>
> Things like 'unique_for_date' and 'unique_together' seem to work great
> in the admin interface, but in the wild, you
Hello Kenneth,
Yes it would. If the user tries to submit a Change that is not unique
on 'student' and 'date' , I want to return them back to the original
page with a message that says "You've already got a change submitted
for that date."
I'm guessing that the programming error has to do with
On 21-Apr-08, at 12:50 AM, radioflyer wrote:
>
> Hello,
> I need some help with the code after the IntegrityError exception.
>
>
> s = Student.objects.get(pk=student_id)
>
> if request.method == 'POST':
> form = ChangeForm(request.POST)
> if form.is_valid():
> try:
>
Hello,
I need some help with the code after the IntegrityError exception.
s = Student.objects.get(pk=student_id)
if request.method == 'POST':
form = ChangeForm(request.POST)
if form.is_valid():
try:
form.save()
request.user.message_set.create(message="Your
6 matches
Mail list logo