widget form

2016-03-19 Thread Tony Peña
hi, if i got a form for example with 2 charfield, and bottom a check box how can i do if that checkbox is true appears the next other 2 charfields ?(maybe hide) this exist with some function on django-admin ? thanxs -- perl -le 's ffSfs.s fSf\x54\x6F\x6E\x79 \x50\x65\x6e\x61f.prin

Re: filter in queryset

2015-09-13 Thread Tony Peña
thanxs so much... that works perfect.! 2015-09-13 11:19 GMT+02:00 James Schneider : > Not sure if I'm following you 100%, but i think you can filter like this: >> >> return qs.filter(classi__prof=request.user) >> >> This would match the MAC to a class, and the class to a professor, and >> the pro

filter in queryset

2015-09-12 Thread Tony Peña
Hi need a help with this queryset problem i got into my models. models.py - class Classi(models.Model): classi = models.CharField('Class Name', max_length='20', unique=True) internet = models.BooleanField(default=None) using Calssi can do: create: A, B. C class Prof(models.Mod

limit insert rows into model database

2015-08-12 Thread Tony Peña
Hi exist some settings to only insert X number of rows in a model? django.db. (i guess, restrict 5 rows) as simple way ? or setting directly into MySQL ? because, i override the save method to check if: # models.py class domain(model.Model): ... max_accounts = models.IntegerField(de

Re: display readonly or not

2015-08-11 Thread Tony Peña
because i don't know how... that's why i ask :) 2015-08-11 11:17 GMT+02:00 Daniel Roseman : > On Tuesday, 11 August 2015 06:24:32 UTC+1, Mike Dewhirst wrote: > > >> There is a get_read_only() method in the admin.ModelAdmin class. It >> normally returns self.readonly_fields but you can give it a c

Re: display readonly or not

2015-08-11 Thread Tony Peña
return self.readonly_fields else: return self.model._meta.get_all_field_names() get_readonly_fields = ro_fields 2015-08-11 7:23 GMT+02:00 Mike Dewhirst : > On 11/08/2015 7:25 AM, Tony Peña wrote: > >> hi >> >> i have this on my model.admin &g

display readonly or not

2015-08-10 Thread Tony Peña
hi i have this on my model.admin class MyDomainAdmin(admin.ModelAdmin): list_display = ('domain', 'enabled', 'avscan', 'spamassassin', 'max_accounts') list_filter = ('enabled',) exclude = ('uid', 'gid', 'maildir') # this part is my pseudo-code logic I want but i can't solved. if