Problem with limit_choices_to and filtering foreign key

2014-08-01 Thread Hilde Rafaelsen
I have two models, ReqForChange(models.Model) and RfcStatus(models.Model). class ReqForChange(models.Model): rfc = models.AutoField (primary_key=True) user = models.ForeignKey(User, verbose_name="Requested by") status = models.ForeignKey(Status, verbose_name="RfC State") effect

Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
Hello, In my django admin page I want to hide some filelds from users if a special field value is set. I have tried different solutions to solve my problem but is stucked and hope someone can help me, If you look at my model I want to hide the field readinessDescription if readiness value is F

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
a fields attribute value from admin before the admin form is posted or stored in database? Do you know? Regards, Hilde from Norway On Friday, May 30, 2014 12:57:19 PM UTC+2, Hilde Rafaelsen wrote: > > Hello, > > In my django admin page I want to hide some filelds from users if a

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
and one more thing. My obj is always none (empty), why is that? On Friday, May 30, 2014 1:49:12 PM UTC+2, Hilde Rafaelsen wrote: > > Hi, > > > > Thanks for the response. > > > > What do you mean by tri-state? > > > > I changed my get_form to this

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
j.readiness == True: > > or just: > if obj.readiness: > > Will give you the same result. > > This way if it doesn't exist it will not fail on the '== TRUE' test. > > > > On Fri, May 30, 2014 at 8:49 AM, Hilde Rafaelsen > wrote: > >> Hi, >

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
I have uploaded my model and admin file and hope someone can tell me why I can't get my get_form method to work :) Regards, Hilde > >> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
> self.exclude = ("readinessDescription", ) > return super(RequestForChangeAdmin, self).get_form(request, obj, > **kwargs) > > > I have never used 'exclude' but it looks like yours should work. > > > On Fri, May 30, 2014 at 9:18 AM, Hilde Rafaelsen