Re: Circularly dependent fixtures fail with Postgres 9.2

2013-06-16 Thread Russell Keith-Magee
Circular dependencies *shouldn't* be a problem on PostgreSQL because all
constraints are set DEFERABLE INITIALLY DEFERRED; that means no constrain
checks should be performed are performed until the transaction boundary, so
all circular references shouldn't be a problem.

Ticket #3615 exists because MySQL's implementation of DEFERABLE INITIALLY
DEFERRED under InnoDB is, to use the technical term, "Broken". It's
unrelated to any problem you may have found in PostgreSQL, because
PostgreSQL gets the underlying behaviour right.

Beyond that, we need a specific test case to take this any further. As it
stands, I'm not aware of any problems loading fixtures into PostgreSQL. If
you are able to construct and provide a set of models (which you have done)
and simple fixture (which you haven't) that fails reliably, we have a new
bug on our hands, and you should open a ticket with all the details you can
provide. Confirming whether this is a problem with the alpha, or an ongoing
problem would also be helpful.

Yours,
Russ Magee %-)

On Mon, Jun 17, 2013 at 6:22 AM, Yo-Yo Ma  wrote:

> There doesn't appear to be a way to load fixtures from JSON (using
> Postgres - works fine in sqlite3) for the following models:
>
>
> class Collection(models.Model):
> main_thing = models.OneToOneField(
> 'things.Thing',
> null=True,
> on_delete=models.SET_NULL
> )
>
> class Thing(models.Model):
> collection = models.ForeignKey(
> 'collections.Collection'
> )
>
>
> Here is the exception:
>
> Problem installing fixture 'my_fixture.json': Could not load
> collections.Collection(pk=1): insert or update on table
> "collections_collection" violates foreign key constraint
> "main_thing_id_refs_id_3a4d3fef"
> DETAIL:  Key (main_thing_id)=(1) is not present in table "things_thing".
>
> I'm not sure if the issue is due to the unique constraint implied by a
> OneToOneField, or if it's just related to this issue:
> https://code.djangoproject.com/ticket/3615 (seems like that ticket and
> related ones have been closed for years, so possibly not related).
>
> Any thoughts?
>
> Note: I'm using @1.6a1
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.




Circularly dependent fixtures fail with Postgres 9.2

2013-06-16 Thread Yo-Yo Ma
There doesn't appear to be a way to load fixtures from JSON (using Postgres 
- works fine in sqlite3) for the following models:


class Collection(models.Model):
main_thing = models.OneToOneField(
'things.Thing',
null=True,
on_delete=models.SET_NULL
)

class Thing(models.Model):
collection = models.ForeignKey(
'collections.Collection'
)


Here is the exception:

Problem installing fixture 'my_fixture.json': Could not load 
collections.Collection(pk=1): insert or update on table 
"collections_collection" violates foreign key constraint 
"main_thing_id_refs_id_3a4d3fef"
DETAIL:  Key (main_thing_id)=(1) is not present in table "things_thing".

I'm not sure if the issue is due to the unique constraint implied by a 
OneToOneField, or if it's just related to this issue: 
https://code.djangoproject.com/ticket/3615 (seems like that ticket and 
related ones have been closed for years, so possibly not related).

Any thoughts?

Note: I'm using @1.6a1

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Localization and Forms with Currencyfields / Value

2013-06-16 Thread Christian Schmitt
The Thing is, some Application that dealing with money have thousand 
separator, and fields without. So it won't work. I've wrote my own Field 
since, I need to deal with both, but I think this is a feature that should 
be included in the core of django.
Or even something like models.DecimalField(grouping=True) not sure how but 
I think its not good to turn THOUSAND_SEPERATOR on globally.
I've encountered localization problems with some template filters 
especially with intcomma.

Am Samstag, 15. Juni 2013 16:31:21 UTC+2 schrieb Aymeric Augustin:
>
> Hi Christian,
>
> Could you clarify why DecimalField doesn't work for your use case?
>
> I suspect you're encountering problems related to localization, but I'm 
> not sure.
>
> Thanks,
>
> -- 
> Aymeric.
>
>
>  
> On 15 juin 2013, at 11:35, Christian Schmitt 
>  
> wrote:
>
> In Django it is nearly impossible to deal with currency values, intcomma 
> would make values to currency and it will work on Django 1.6a1 with 
> Decimals, 
> but still when I have a ModelForm or Form I can't validate a 
> intcomma(Decimal()) Value. It will always be incorrect.
> Maybe its time now to let Django have a CurrencyField in core or even 
> better functions for dealing with currency values.
>
> I mean I would maybe contribute something to django, but maybe i'm too 
> scared that my code isn't correct or even not that good to get contributed.
> It would just be another improvement for django when the handling of 
> Currencies would be less worse than it is now.
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-develop...@googlegroups.com .
> To post to this group, send email to django-d...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/django-developers.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.