Hi,
On 04/02/2010 05:12 PM, H.İbrahim Yılmaz wrote:
> Hi all,
> I get "global name 'self' is not defined" error what is the problem?
> Thanks.
>
> from django.db import models
> from django.forms import *
> from yenicrm.musteri.models import *
> from django.contrib.auth.models import User
> from django.forms.extras.widgets import *
>
> # Create your models here.
> class Ziyaret(models.Model):
> tarih = models.DateField()
> temsilci = models.ForeignKey(User)
> musteri = models.ForeignKey(Musteri)
> gorusler = models.TextField()
>
> class ZiyaretForm(ModelForm):
> tarih = DateField(widget=SelectDateWidget())
> musteri = ModelChoiceField(queryset = Musteri.objects.none())
>
> def __init__(temsilci = None, *args, **kwargs):
> super(ZiyaretForm, self).__init__(*args, **kwargs)
> self.fields["musteri"] = Musteri.objects.none() if temsilci is
> None else Musteri.objects.filter(temsilci = temsilci)
>
> class Meta:
> model = Ziyaret
> exclude = ("temsilci",)
>
>
def __init__(self, ...) ;)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.