Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 7, 2005 12:16:44

[EMAIL P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Editing inline object individually


Hi

I have classes that are edited inline. When you come to edit them
indivdually in the admin interface they error with teh following
message.

ProgrammingError: ERROR: invalid input syntax for integer: ""

because in the admin screen the foregin key field that is defined as
inline edited is not displayed, hence blank

It's a bit of a problem for me because i want to do this.

Allow users to create a Purchase Order which has several Items (of
equipment) so item's are edited inline with purchase orders.

Then for each Item needs to be edited individually including it's
Properties which is another class edited inline with Items

Is this just something djamgo doesn't do or have I defined my models
wrong.

class PurchaseOrder(meta.Model):
fields = (
meta.CharField('order_number', maxlength=25),
meta.CharField('supplier', maxlength=100),
meta.DateField('date_sent', auto_now_add=True),
meta.CharField('notes', maxlength=250, blank=True,
null=True),
)


class Item(meta.Model):
fields = (
meta.CharField('description', maxlength=250, core=True),
meta.CharField('type', maxlength=100, core=True),
meta.CharField('grant_holder', maxlength=100, core=True),
meta.CharField('cost_code', maxlength=25, core=True),
meta.CharField('serial_number', maxlength=30, blank=True,
null=True),
meta.ForeignKey(PurchaseOrder, edit_inline=meta.TABULAR,
num_in_admin=6),
)

class ItemProperty(meta.Model):
fields = (
meta.ForeignKey(Item, edit_inline=meta.TABULAR,
num_in_admin=6),
meta.ForeignKey(PropertyType, core=True),
meta.CharField('value', maxlength=100, core=True),
)

Thanks
Charlie

Offline

#2 Nov. 7, 2005 14:58:25

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Editing inline object individually


On 11/7/05, <> wrote:
> It's a bit of a problem for me because i want to do this.
>
> Allow users to create a Purchase Order which has several Items (of
> equipment) so item's are edited inline with purchase orders.
>
> Then for each Item needs to be edited individually including it's
> Properties which is another class edited inline with Items
>
> Is this just something djamgo doesn't do or have I defined my models
> wrong.

It's something Django doesn't do right now. Only one "level" of
edit_inline is supported. It's not possible for edit_inline to span
more than one level.

However, this should be changing soon, with the new-admin code branch,
which is currently being developed.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#3 Nov. 7, 2005 16:56:08

Robert W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Editing inline object individually


Adrian Holovaty wrote:
> On 11/7/05, <> wrote:
>
>>It's a bit of a problem for me because i want to do this.
>>
>>Allow users to create a Purchase Order which has several Items (of
>>equipment) so item's are edited inline with purchase orders.
>>
>>Then for each Item needs to be edited individually including it's
>>Properties which is another class edited inline with Items
>>
>>Is this just something djamgo doesn't do or have I defined my models
>>wrong.
>
>
> It's something Django doesn't do right now. Only one "level" of
> edit_inline is supported. It's not possible for edit_inline to span
> more than one level.
>
> However, this should be changing soon, with the new-admin code branch,
> which is currently being developed.
>
> Adrian
>
Just a note : although some of the changes in new-admin are a necessary
prerequisite for multilevel edit_inline, the plan was not to do it in
that branch as it also involves getting rid of core fields. As the
new-admin branch is still meant to be fully backwards compatible, I
wasn't planning to get rid of core fields in it as this would
necessitate model changes.

I think the best idea would be a relatively short lived branch, after
new-admin merges, in which all of the pending model changes can be done.
Then people can change their models in one hit, when this future branch
is merged to trunk, rather than in dribs and drabs.

For the specific case of editing an inline_edited object seperately in
its own admin form, (which I believe the original poster would be
satisfied with as a stop gap measure), this should already work in
new-admin AFAIK. The foreign key with edit_inline=whatever is rendered
as a foreign key select field like any other, ie you can select the
objects "parent".

Robert

Offline

#4 Nov. 18, 2005 07:09:53

Qi C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Editing inline object individually


> For the specific case of editing an inline_edited object seperately in
> its own admin form, (which I believe the original poster would be
> satisfied with as a stop gap measure), this should already work in
> new-admin AFAIK. The foreign key with edit_inline=whatever is rendered
> as a foreign key select field like any other, ie you can select the
> objects "parent".

We are now developping 3 level interface with new-admin branch exactly
like original poster, and found out that need modify tons of lines of
source code, not an easy work.
Would you please let us know from where/who we can get the working
admin, or how long will it be merged into admin.

Thanks.

Offline

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support