I get same error as before; 'NoneType' object has no attribute 'readiness'
when I changed to your excample. I don't understand why this is not working
for me, but for everyone else
Is it something I have forgot to import? I hope you can take a quick look
at my uploaded files. Is it ok to ju
try this get_form:
def get_form(self, request, obj=None, **kwargs):
if obj.readiness:
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:
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
Thanx,
I now changed my if test to just if obj.readines but then I get the error
message 'NoneType' object has no attribute 'readiness'
I have tried with several fields from my model, but I always get this
error. I guess it must be something essential I am doing wrong here, since
my obj seems
Maybe it is not possibly to get a fields attribute value from admin before
the admin form is posted or stored in database? Do you know?
Yes, it is possible. I use this to set which fields are readonly before
defining the fieldsets. It works great.
def get_form(self, request, obj=None, **kwargs
What do you mean by tri-state?
You are using a field that allows three states: TRUE, FALSE and NULL.
If I understand the model, readiness would either be TRUE or FALSE. But if
you do not want to change your field type to:
readiness = models.BooleanField("Readiness", blank=True)
then try changin
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:
>
> def get_form(self, request, obj=None,
Hi,
Thanks for the response.
What do you mean by tri-state?
I changed my get_form to this:
def get_form(self, request, obj=None, **kwargs):
form = super(RequestForChangeAdmin,
self).get_form(request, obj, **kwargs)
if o
Is 'readiness' really a tri-state flag?
Anyway you may want to test if obj.readiness exists, and is TRUE.
if obj.readiness and obj.readiness == TRUE:
HTH,
Tim
On Fri, May 30, 2014 at 7:57 AM, Hilde Rafaelsen
wrote:
> Hello,
>
> In my django admin page I want to hide some filelds from users
9 matches
Mail list logo