Re: newforms-admin replacement for core=True in inline models?

2008-02-03 Thread Brian Rosner

> Yes, I think that is the problem.  It's not just Boolean fields -- any field
> that has a default set to something non-blank will make the inline-edited
> item seem non-empty on a save attempt.  Not sure what the right way to fix
> this is...it's probably worth opening an issue in trac if you can't find
> anything matching.

http://code.djangoproject.com/ticket/5878 -- I am still unsure of the 
correct way to fix this, but it is a known issue.

-- 
Brian Rosner
http://oebfare.com



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms-admin replacement for core=True in inline models?

2008-02-03 Thread Karen Tracey
On Feb 3, 2008 10:38 AM, NickJ <[EMAIL PROTECTED]> wrote:

>
> I was definately getting this issue. Cant find any related issue in
> track. I have gone back to standard trunk due to this error so I cant
> retest right now, but I think the inline model that gives this error
> is:
>
> class Link(models.Model):
>""" Outbound link for directory item. """
>directory_item = models.ForeignKey(DirectoryItem)
>url = models.URLField(verify_exists=False, core=True)
>title = models.CharField(max_length=40, blank=True)
>alt = models.CharField(max_length=100, blank=True)
>is_active = models.BooleanField(default=True)
>is_primary = models.BooleanField(default=True)
>
>
> Perhaps the issue is with the boolean fields having default set to
> True - perhaps the widgets getting "checked" by default tricks the
> admin in to thinking the fields havent been left blank?
>

Yes, I think that is the problem.  It's not just Boolean fields -- any field
that has a default set to something non-blank will make the inline-edited
item seem non-empty on a save attempt.  Not sure what the right way to fix
this is...it's probably worth opening an issue in trac if you can't find
anything matching.

If you cant replicate the issue, I will switch back to newforms-admin
> and get a replication of the error.
>

> (whilst I´m at it, I found another issue with admin (both newforms and
> normal) with this model: it was throwing very strange errors with any
> URL field set as unique=True)
>

This sounds like something different perhaps deserving of its own thread and
more details of the "very strange errors".

Cheers,
Karen


> On Feb 2, 4:03 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > On Feb 1, 2008 7:52 PM, NickJ <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Thanks for the response. So what code do I need to add so that, when
> > > creating a new object, the admin doesnt try to create related fields
> > > that are left entirely blank? I still see core=True as an option, but
> > > it no longer does anything, and I still dont understand what the
> > > solution is or will be.
> >
> > You shouldn't have to do anything.  Inline-edited items that are empty
> > should be ignored during add processing.  There was a problem at one
> point
> > where entirely blank items were being flagged as validation errors, but
> that
> > has been fixed.  I'm don't recall ever seeing problems with entirely
> empty
> > items being constructed.  Could you give details of your models and what
> > behavior you are seeing (I'm not sure if you are getting validation
> errors
> > for blank items or spurious all-blank items added to the database?).
>  Maybe
> > check trac for reports of problems like what you are seeing.  I haven't
> been
> > able to keep up to date for a few weeks, but had been running on
> > newforms-admin without running into what it sounds like you are
> reporting,
> > so it's either something specific to your models or perhaps something
> that
> > has changed recently.
> >
> > Karen
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms-admin replacement for core=True in inline models?

2008-02-03 Thread NickJ

I was definately getting this issue. Cant find any related issue in
track. I have gone back to standard trunk due to this error so I cant
retest right now, but I think the inline model that gives this error
is:

class Link(models.Model):
""" Outbound link for directory item. """
directory_item = models.ForeignKey(DirectoryItem)
url = models.URLField(verify_exists=False, core=True)
title = models.CharField(max_length=40, blank=True)
alt = models.CharField(max_length=100, blank=True)
is_active = models.BooleanField(default=True)
is_primary = models.BooleanField(default=True)


Perhaps the issue is with the boolean fields having default set to
True - perhaps the widgets getting "checked" by default tricks the
admin in to thinking the fields havent been left blank?

If you cant replicate the issue, I will switch back to newforms-admin
and get a replication of the error.

(whilst I´m at it, I found another issue with admin (both newforms and
normal) with this model: it was throwing very strange errors with any
URL field set as unique=True)

On Feb 2, 4:03 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Feb 1, 2008 7:52 PM, NickJ <[EMAIL PROTECTED]> wrote:
>
>
>
> > Thanks for the response. So what code do I need to add so that, when
> > creating a new object, the admin doesnt try to create related fields
> > that are left entirely blank? I still see core=True as an option, but
> > it no longer does anything, and I still dont understand what the
> > solution is or will be.
>
> You shouldn't have to do anything.  Inline-edited items that are empty
> should be ignored during add processing.  There was a problem at one point
> where entirely blank items were being flagged as validation errors, but that
> has been fixed.  I'm don't recall ever seeing problems with entirely empty
> items being constructed.  Could you give details of your models and what
> behavior you are seeing (I'm not sure if you are getting validation errors
> for blank items or spurious all-blank items added to the database?).  Maybe
> check trac for reports of problems like what you are seeing.  I haven't been
> able to keep up to date for a few weeks, but had been running on
> newforms-admin without running into what it sounds like you are reporting,
> so it's either something specific to your models or perhaps something that
> has changed recently.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms-admin replacement for core=True in inline models?

2008-02-01 Thread Karen Tracey
On Feb 1, 2008 7:52 PM, NickJ <[EMAIL PROTECTED]> wrote:

>
> Thanks for the response. So what code do I need to add so that, when
> creating a new object, the admin doesnt try to create related fields
> that are left entirely blank? I still see core=True as an option, but
> it no longer does anything, and I still dont understand what the
> solution is or will be.
>

You shouldn't have to do anything.  Inline-edited items that are empty
should be ignored during add processing.  There was a problem at one point
where entirely blank items were being flagged as validation errors, but that
has been fixed.  I'm don't recall ever seeing problems with entirely empty
items being constructed.  Could you give details of your models and what
behavior you are seeing (I'm not sure if you are getting validation errors
for blank items or spurious all-blank items added to the database?).  Maybe
check trac for reports of problems like what you are seeing.  I haven't been
able to keep up to date for a few weeks, but had been running on
newforms-admin without running into what it sounds like you are reporting,
so it's either something specific to your models or perhaps something that
has changed recently.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms-admin replacement for core=True in inline models?

2008-02-01 Thread NickJ

Thanks for the response. So what code do I need to add so that, when
creating a new object, the admin doesnt try to create related fields
that are left entirely blank? I still see core=True as an option, but
it no longer does anything, and I still dont understand what the
solution is or will be.

Cheers
Nick

Russell Keith-Magee wrote:
> On Feb 2, 2008 4:32 AM, NickJ <[EMAIL PROTECTED]> wrote:
> >
> > I wanted to bump this up, because if there is no solution I think this
> > is an issue which needs to be rectified before it is merged to trunk.
>
> There is a solution - it just hasn't been documented yet.
>
> The oldforms 'core=True' approach has been deprecated in favour of
> providing a checkbox that specifies that a row needs to be deleted.
> When you set up the FormSet, you can specify if rows are deletable; if
> they are, you get the checkbox on each row. This can be specified on a
> per-form basis, rather than messing up the model definition.
> Validation of individual rows (i.e., these three fields are required
> as a minimum) is handled by the forms that are wrapped into a form
> set.
>
> If you're still seeing core=True as an option, it's because work isn't
> finished yet. There are still pieces of newforms-admin that rely upon
> oldforms manipulators - we haven't finished housekeeping yet.
>
> Yours
> Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms-admin replacement for core=True in inline models?

2008-02-01 Thread Russell Keith-Magee

On Feb 2, 2008 4:32 AM, NickJ <[EMAIL PROTECTED]> wrote:
>
> I wanted to bump this up, because if there is no solution I think this
> is an issue which needs to be rectified before it is merged to trunk.

There is a solution - it just hasn't been documented yet.

The oldforms 'core=True' approach has been deprecated in favour of
providing a checkbox that specifies that a row needs to be deleted.
When you set up the FormSet, you can specify if rows are deletable; if
they are, you get the checkbox on each row. This can be specified on a
per-form basis, rather than messing up the model definition.
Validation of individual rows (i.e., these three fields are required
as a minimum) is handled by the forms that are wrapped into a form
set.

If you're still seeing core=True as an option, it's because work isn't
finished yet. There are still pieces of newforms-admin that rely upon
oldforms manipulators - we haven't finished housekeeping yet.

Yours
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms-admin replacement for core=True in inline models?

2008-02-01 Thread NickJ

I wanted to bump this up, because if there is no solution I think this
is an issue which needs to be rectified before it is merged to trunk.
As Felix noted, without core=True support, anything listed as in-line
*has to be created when you create the parent object. e.g. if a Pizza
can have 1+ toppings, and the Topping name is a required field, and 3
Toppings fields are shown inline on Pizza creation, then *all three*
have to be used, otherwise validation errors occur on Pizza.

In the old django admin, this is not an issue with the Core fields,
which identify what fields flag a field as "user is trying to be
create me inline".

(I apologise if this should be added as a bug to track etc instead of
here. I am new to using a django branch, and I'm unsure on the policy
on what I should be reporting. By looking in track, it seems that the
current status of newforms-admin is very close to being merged with
trunk (only a dozen or so minor issues listed as deal-breakers).
However after a few days use, I have found various large issues, or at
least undocumented backwards-incompatabilities. For example, this
issue 
http://groups.google.com/group/django-users/browse_thread/thread/f889fce3e854257e#
I posted in django users regarding one-to-one fields.)

On Jan 25, 8:47 am, James T <[EMAIL PROTECTED]> wrote:
> Felix,
>
> > Inline objects now have a 'delete' checkbox which is used for removing
> > objects.
>
> Oh yeah! Well that answers the delete question, thanks.
>
> > I believe that the usual admin rules apply for creating models i.e.
> > all fields without blank=True will be required, otherwise you'll get
> > validation errors.
>
> I see, however there's still a feature of core=True which I can't seem
> to find: if you left the core field blank the related record wouldn't
> get created.
>
> As it is I've set blank=True on all the inline model's fields.
> However, each time I save the parent object 3 blank related objects
> are being created (as I have extra=3 set).
>
> Is there a way around this problem?
>
> James
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms-admin replacement for core=True in inline models?

2008-01-25 Thread James T

Felix,

> Inline objects now have a 'delete' checkbox which is used for removing
> objects.

Oh yeah! Well that answers the delete question, thanks.

> I believe that the usual admin rules apply for creating models i.e.
> all fields without blank=True will be required, otherwise you'll get
> validation errors.

I see, however there's still a feature of core=True which I can't seem
to find: if you left the core field blank the related record wouldn't
get created.

As it is I've set blank=True on all the inline model's fields.
However, each time I save the parent object 3 blank related objects
are being created (as I have extra=3 set).

Is there a way around this problem?

James
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms-admin replacement for core=True in inline models?

2008-01-24 Thread [EMAIL PROTECTED]

Hi James,

> I have hit a wall with newforms-admin, which seems obvious but I can't
> find mention of a solution anywhere.
>
> As I understand it, part of core=True was defining when the related
> object was created or deleted.
>
> eg: "The related model being edited inline must specify one or more
> "core" fields using core=True. If the core fields are filled in, the
> related model is added. If the core fields are empty, the related
> model is removed."
>
> As core=True has been removed form newforms-admin how can I replicate
> this behaviour?

Inline objects now have a 'delete' checkbox which is used for removing
objects.
I believe that the usual admin rules apply for creating models i.e.
all fields without blank=True will be required, otherwise you'll get
validation errors.

Replicating the actual behaviour (i.e. blanking fields to delete
objects) would require a bit more hacking.

Hope that helps,

Felix
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---