On 7/9/07, TheOrb <[EMAIL PROTECTED]> wrote:
>
> I am new to Django and getting started with the Poll example.
>
> 1 ) While in the Shell if type "Poll.objects.a() " I get the result
>     [<Poll: Poll object>, <Poll: Poll objects>]
>
>     Why am I getting 2 poll objects and what command can I use to
> delete one.

Well - you are getting two poll objects because... there are two poll
objects in the database.

To delete one, you need to select a single object, and call delete()
on it. There are many ways you could do this - which one is correct
will depend on which data you want to keep. However, here are some
examples of ways to select and delete objects:

Poll.objects.all()[0].delete() # Delete the first object in the result set
Poll.objects.get(pk=1).delete() # Delete the object with primary key of 1
Poll.objects.get(name='Foobar').delete() # Delete the object with a
name of 'Foobar'

> 2) I can view the Admin screen but I am still unable to view the poll
> app.
>     I've added a new class (see below) to mysite/polls/models.py but
> the Admin screen remains unchanged.
>
> class Poll(models.Model):
>     # ...
>     class Admin:
>         pass
>
> Any help would be appreciated

The most obvious reason for this is that mysite.polls isn't in your
INSTALLED_APPS list.

The second reason would be that the web server hasn't loaded the
change to the Poll model. If you are using mod_python, you will need
to restart apache; if you are using the development server, try
restarting the server.

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to