Exactly, I think an assumption was made in the original design of the
URLs about the values of the primary keys, maybe that they would be
numeric. So this case brakes that assumption.

Marwan

On Mon, Apr 4, 2011 at 12:52 AM, Marc Aymerich <glicer...@gmail.com> wrote:
>
>
> On Fri, Apr 1, 2011 at 8:39 PM, Marwan Al-Sabbagh
> <marwan.alsabb...@gmail.com> wrote:
>>
>> Hi,
>>   just wanted to confirm that this is a bug before posting it on
>> tracker. Any comments are welcome it will be my first bug report on
>> django :)
>>
>> Problem
>> ========
>>  If you have a model with a primary key field that has the value
>> 'add' you won't be able to edit it in the admin screens. the admin
>> will take you to the add page instead of the change page for that
>> record. this is a problem with the design of the urls in the admin
>> module.
>>
>> admin.py
>> =========
>> from polls.models import poll
>> from django.contrib import admin
>>
>> admin.site.register(poll)
>>
>> model.py
>> =========
>> from django.db import models
>>
>> class poll(models.Model):
>>    id = models.CharField(max_length=200, primary_key=True)
>>    question = models.CharField(max_length=200)
>>
>> Reproducing
>> ============
>>  1. Create project and app, enable admin, add the above files and syncdb.
>>  2. Go to the admin interface and select Add poll
>>  3. specify 'add' as the id and 'test' as question
>>  4. Save
>>  5. Go back to the list
>>  6. Open the same object
>>  7. you will be taken to the add poll screen instead of the change
>> poll screen for the selected object
>
>
> The problem here is the change view URL of an object with 'add' as a primary
> key is the same as add view URL :)
> --
> Marc
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to