Re: [Django] #21508: ForeignKey cast to int despite being varchar

2015-10-07 Thread Django
#21508: ForeignKey cast to int despite being varchar
-+-
 Reporter:  fiomtec@…|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.5
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * status:  new => closed
 * resolution:   => needsinfo


Comment:

 I don't think we have enough information in the report to reproduce the
 issue. I tested a `ForeignKey` to a `CharField` and didn't have any
 problems on SQLite or PostgreSQL.

 Could it be a problem with sqlserver or the database backend you are
 using? Please reopen if you can provide more details. A failing test case
 would be helpful.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.59f8be2d943ef481e495d5c3440969e5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #21508: ForeignKey cast to int despite being varchar

2013-12-06 Thread Django
#21508: ForeignKey cast to int despite being varchar
-+-
 Reporter:  fiomtec@…|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.5
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by aaugustin):

 * stage:  Unreviewed => Accepted


Comment:

 Accepting on the basis that the examples clearly demonstrate unexpected
 behavior.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.602fe791f7ad6adc2a2a5a3ed2472e1a%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21508: ForeignKey cast to int despite being varchar

2013-11-26 Thread Django
#21508: ForeignKey cast to int despite being varchar
-+-
 Reporter:  fiomtec@…|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.5
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by fiomtec@…):

 Ok, I've been doing a bit more testing. It seems that it doesn't have to
 do with the column being a ForeignKey, but with the db column being a
 foreign key. I've redefined my model like this:


 {{{
 class Confirmacion(models.Model):
 cliente = models.CharField(db_column='entidad_propietaria',
 max_length=8)
 fecha_orden = models.CharField(max_length=8)
 [...]other fields[...]
 }}}

 When I query some objects, fecha_orden will always be a string (despite it
 being a date in the form MMDD), but cliente will be a string if it's
 something like 'MADRID', but an integer if it can be converted.

 Both columns are defined as varchar(8) not null in the database, the only
 difference is that entidad_propietaria is a foreign key to another table,
 and fecha_orden isn't.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.ae1a8ffa063f3a4b3b1ae28b29ef55d2%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21508: ForeignKey cast to int despite being varchar

2013-11-25 Thread Django
#21508: ForeignKey cast to int despite being varchar
-+-
 Reporter:  fiomtec@…|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.5
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by MarkusH):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Looks to me like it is the same underlying problem as shown in #14518 or
 at least related.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.4e6cba73d9044418c53d32c348f5b526%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Django] #21508: ForeignKey cast to int despite being varchar

2013-11-25 Thread Django
#21508: ForeignKey cast to int despite being varchar
--+
 Reporter:  fiomtec@… |  Owner:  nobody
 Type:  Bug   | Status:  new
Component:  Database layer (models, ORM)  |Version:  1.5
 Severity:  Normal|   Keywords:
 Triage Stage:  Unreviewed|  Has patch:  0
Easy pickings:  0 |  UI/UX:  0
--+
 Hi!

 I have a couple of models connected to a read-only sqlserver DB, like this
 (trimmed to the important details):


 {{{
 class Cliente(models.Model):
 codigo = models.CharField(max_length=8, primary_key=True)
 nif = models.CharField(max_length=15)
 nombre = models.CharField(max_length=100,
 db_column='nombre_apellidos')


 class Confirmacion(models.Model):
 cliente = models.ForeignKey(Cliente, db_column='entidad_propietaria',
 max_length=8)
 [...]other fields[...]
 }}}


 When I try to find some Confirmacion objects filtering by nif like this:


 {{{
 Confirmacion.objects.filter(cliente__nif=nif).all()
 }}}


 it will correctly find some results, but blow up when I try to access
 them. e.g., this is a dict from one Confirmacion result:

 {'cliente_id': 7502, '_state': , [...] other fields [...]}

 the problem is that the correct cliente_id is not 7502, but '007502', and
 when I try to access that confirmacion.cliente, I get a "Cliente matching
 query does not exist" exception.

 I also tried using to_field="codigo", same result.

 Am I doing something wrong?. Shouldn't the id be a string since the pk is
 defined as a charfield?.

 Thanks.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/060.341419b30c370f7da2540abfd3752622%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.