Super is one of python’s greatest mistakes. 
http://docs.python.org/library/functions.html#super The form is
class class_name(parent_class):
    def method(self, *args, **kwargs):
        super(class_name, self).method(*args, **kwargs)

It’s better in Python 3, but Django hasn’t been ported over yet.

On Jun 1, 2012, at 10:03 AM, Schmidtchen Schleicher wrote:

> Thank you for your effort, as far as I can see you understood my problem 
> right and your solution could work... if there wouldn't be that error:
> TypeError at /kalender/1/new_termin/
> 
> super(type, obj): obj must be an instance or subtype of type
> 
> Termin is a model class, NewTerminForm is a modelformclass (Termin is german 
> for appointment). This is the first time I use super() so I don't know how to 
> solve this problem
> 
> 
> Am Freitag, 1. Juni 2012 02:48:04 UTC+2 schrieb Kurtis:
> One minor edit to that:
> form.save(request) -> form.save(request, kalender)
> 
> On Thu, May 31, 2012 at 8:47 PM, Kurtis Mullins <kurtis.mull...@gmail.com> 
> wrote:
> Hey,
> 
> I tried re-writing your view and form for you -- but I ran into a snag. I 
> don't read German so other than code-wise (and a couple of obvious words, 
> like kalender and participants) I'm not really sure what you're trying to 
> accomplish.
> 
> I do see one obvious issue, though. Participants is a many-to-many field in 
> your Model and you're also using the same attribute in your form. Here's 
> something you could try in your form and view:
> 
> View:
> --------
> if request.method == 'POST':
>     form = MyForm(request.POST)
>     if form.is_valid():
>         form.save(request)
> 
> Form:
> ---------
> def save(self, request, kalender, commit=True):
> 
>     # Get an Instance of the Termin object.
>     obj = super(Termin, self).save(commit=True)
>    
>     # Add the user as a participant if 'add_me' = True
>     if self.cleaned_data['add_me']:
>         obj.participants.add(request.user)
> 
>     # Set the Calendar, Save, and return
>     obj.in_calendar = kalender
>     obj.save()
>     return obj
> 
> Hopefully I didn't just confuse you more :) Good luck!
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/WyKASDjYNEgJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

Peter of the Norse
rahmc...@radio1190.org



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to