Solved, I corrected the __init__ method with this:
def __init__(self, *args, **kwargs):
super(CategoriaForm,self).__init__(*args,**kwargs);
if kwargs.has_key('instance'):
self.fields['parent'].queryset = Categoria.objects.exclude
Maybe I missing some step:
I trying to set up the the automatic admin page form to edit a
category tree builded with treebeard extension:
#Model:
class Categoria(AL_Node,Componente):
immagine = fields.ImageWithThumbnailsField
(upload_to=Componente.image_path + 'categorie/',
On Fri, 2008-12-26 at 23:13 -0800, Tony Chu wrote:
> Thank you very much Malcolm. The methods I listed above has worked for
> me so far - so your response is reassuring.
>
> I was just surprised that no one had encountered a similar need
> already. The concept here is parallel to getting a list
Thank you very much Malcolm. The methods I listed above has worked for
me so far - so your response is reassuring.
I was just surprised that no one had encountered a similar need
already. The concept here is parallel to getting a list of
territories in a country, dynamically fetched based on
On Wed, 2008-12-10 at 00:18 -0800, Tony Chu wrote:
> Hi All,
>
> I was using the ModelForm to generate my first form in Django.
> ModelForm is great. However, I had wanted to dynamically limit the
> selection of Foreign keys to a subset I generate.
>
> The only way I found after a lot of
Hi All,
I was using the ModelForm to generate my first form in Django.
ModelForm is great. However, I had wanted to dynamically limit the
selection of Foreign keys to a subset I generate.
The only way I found after a lot of trial and error was the following:
form['foreignkey'].field.queryset
6 matches
Mail list logo