Re: [Django] #15082: delete() does not function consistently with CharField PKs

2011-01-14 Thread Django
#15082: delete() does not function consistently with CharField PKs
-+--
  Reporter:  w004dal | Owner:  nobody   
Status:  closed  | Milestone:   
 Component:  Core framework  |   Version:  1.2  
Resolution:  invalid |  Keywords:  model, db
 Stage:  Unreviewed  | Has_patch:  0
Needs_docs:  1   |   Needs_tests:  0
Needs_better_patch:  0   |  
-+--
Comment (by w004dal):

 Please reopen this bug to at least improve the documentation on
 http://docs.djangoproject.com/en/dev/topics/db/queries to include this
 subtlety.

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #15082: delete() does not function consistently with CharField PKs

2011-01-14 Thread Django
#15082: delete() does not function consistently with CharField PKs
-+--
  Reporter:  w004dal | Owner:  nobody   
Status:  closed  | Milestone:   
 Component:  Core framework  |   Version:  1.2  
Resolution:  invalid |  Keywords:  model, db
 Stage:  Unreviewed  | Has_patch:  0
Needs_docs:  1   |   Needs_tests:  0
Needs_better_patch:  0   |  
-+--
Comment (by russellm):

 If you have questions, please ask them on django-users.

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #15082: delete() does not function consistently with CharField PKs

2011-01-14 Thread Django
#15082: delete() does not function consistently with CharField PKs
-+--
  Reporter:  w004dal | Owner:  nobody   
Status:  closed  | Milestone:   
 Component:  Core framework  |   Version:  1.2  
Resolution:  invalid |  Keywords:  model, db
 Stage:  Unreviewed  | Has_patch:  0
Needs_docs:  1   |   Needs_tests:  0
Needs_better_patch:  0   |  
-+--
Changes (by w004dal):

  * needs_docs:  0 => 1

Comment:

 What is the expected behavior for the class below? {{{ DoesWork }}} should
 be syntactic sugar for DoesNotWorkToo:

 {{{
 class DoesNotWorkToo(models.Model):
 some_key = models.IntegerField(primary_key=True)
 mac_id = models.CharField(max_length=17)
 ip = models.CharField('Host/IP Address', max_length=255)
 }}}

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #15082: delete() does not function consistently with CharField PKs

2011-01-14 Thread Django
#15082: delete() does not function consistently with CharField PKs
-+--
  Reporter:  w004dal | Owner:  nobody   
Status:  new | Milestone:   
 Component:  Core framework  |   Version:  1.2  
Resolution:  |  Keywords:  model, db
 Stage:  Unreviewed  | Has_patch:  0
Needs_docs:  0   |   Needs_tests:  0
Needs_better_patch:  0   |  
-+--
Changes (by russellm):

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

Old description:

> I'm working with MyISAM tables with MySQL and have the following behavior
> with delete() on Django 1.2.3-1 on Fedora Core 12.
>
> class DoesWork(models.Model):
> mac_id = models.CharField(max_length=17)
> ip = models.CharField('Host/IP Address', max_length=255)
>
> class DoesNotWork(models.Model):
> mac_id = models.CharField(max_length=17, primary_key=True)
> ip = models.CharField('Host/IP Address', max_length=255)
>
> The following works as expected, creating, deleting, and putting the item
> back:
> zz = DoesWork.objects.create(mac_id='99:99:99:99:99:99', ip='127.0.0.1')
> zz.delete() # remove from DB
> zz.save() # it's back in the DB
>
> However, if I use the DoesNotWork model, whose only difference is having
> a CharField as a primary key:
> zz = DoesNotWork.objects.create(mac_id='99:99:99:99:99:99',
> ip='127.0.0.1')
> zz.delete() # remove from DB
> zz.save() # EXCEPTION THROWN:
>
> IntegrityError: (1048, "Column 'mac_id' cannot be null")
>
> I checked by printing out zz.__dict__, and the mac_id was 'None' with the
> DoesNotWork object, but was untouched with the DoesWork object.

New description:

 I'm working with MyISAM tables with MySQL and have the following behavior
 with delete() on Django 1.2.3-1 on Fedora Core 12.
 {{{
 class DoesWork(models.Model):
 mac_id = models.CharField(max_length=17)
 ip = models.CharField('Host/IP Address', max_length=255)

 class DoesNotWork(models.Model):
 mac_id = models.CharField(max_length=17, primary_key=True)
 ip = models.CharField('Host/IP Address', max_length=255)
 }}}
 The following works as expected, creating, deleting, and putting the item
 back:
 {{{
 zz = DoesWork.objects.create(mac_id='99:99:99:99:99:99', ip='127.0.0.1')
 zz.delete() # remove from DB
 zz.save() # it's back in the DB
 }}}
 However, if I use the DoesNotWork model, whose only difference is having a
 CharField as a primary key:
 {{{
 zz = DoesNotWork.objects.create(mac_id='99:99:99:99:99:99',
 ip='127.0.0.1')
 zz.delete() # remove from DB
 zz.save() # EXCEPTION THROWN:

 IntegrityError: (1048, "Column 'mac_id' cannot be null")
 }}}
 I checked by printing out zz.!__dict!__, and the mac_id was 'None' with
 the DoesNotWork object, but was untouched with the DoesWork object.

Comment:

 Corrected formatting. Please use preview.

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #15082: delete() does not function consistently with CharField PKs

2011-01-14 Thread Django
#15082: delete() does not function consistently with CharField PKs
-+--
  Reporter:  w004dal | Owner:  nobody   
Status:  closed  | Milestone:   
 Component:  Core framework  |   Version:  1.2  
Resolution:  invalid |  Keywords:  model, db
 Stage:  Unreviewed  | Has_patch:  0
Needs_docs:  0   |   Needs_tests:  0
Needs_better_patch:  0   |  
-+--
Changes (by russellm):

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

Comment:

 This is working as expected. When you delete the object, it's primary key
 is set to None. In the model DoesNotWork, the primary key is manually
 allocated, so subsequent saves are prevented. In the model DoesWork, the
 primary key is automatically allocated, so a new object is inserted.

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



[Django] #15082: delete() does not function consistently with CharField PKs

2011-01-14 Thread Django
#15082: delete() does not function consistently with CharField PKs
+---
 Reporter:  w004dal |   Owner:  nobody
   Status:  new |   Milestone:
Component:  Core framework  | Version:  1.2   
 Keywords:  model, db   |   Stage:  Unreviewed
Has_patch:  0   |  
+---
 I'm working with MyISAM tables with MySQL and have the following behavior
 with delete() on Django 1.2.3-1 on Fedora Core 12.

 class DoesWork(models.Model):
 mac_id = models.CharField(max_length=17)
 ip = models.CharField('Host/IP Address', max_length=255)

 class DoesNotWork(models.Model):
 mac_id = models.CharField(max_length=17, primary_key=True)
 ip = models.CharField('Host/IP Address', max_length=255)

 The following works as expected, creating, deleting, and putting the item
 back:
 zz = DoesWork.objects.create(mac_id='99:99:99:99:99:99', ip='127.0.0.1')
 zz.delete() # remove from DB
 zz.save() # it's back in the DB

 However, if I use the DoesNotWork model, whose only difference is having a
 CharField as a primary key:
 zz = DoesNotWork.objects.create(mac_id='99:99:99:99:99:99',
 ip='127.0.0.1')
 zz.delete() # remove from DB
 zz.save() # EXCEPTION THROWN:

 IntegrityError: (1048, "Column 'mac_id' cannot be null")

 I checked by printing out zz.__dict__, and the mac_id was 'None' with the
 DoesNotWork object, but was untouched with the DoesWork object.

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.