This worked for me in ubuntu:
python manage.py shell
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)

*>>> from polls.models import Question, Choice*
*>>> from django.utils import timezone*

*>>> q = Question(question_text="What's up?", pub_date=timezone.now())*

*>>> q.save()*
*>>> q.id <http://q.id>*
1
*>>> q.question_text*
"What's up?"


I just did the above and I got a message
from this page url:*https://docs.djangoproject.com/en/1.8/intro/tutorial01/
<https://docs.djangoproject.com/en/1.8/intro/tutorial01/>*

I hope this helps, try it again


On Tue, Jul 14, 2015 at 1:47 PM, Auj Snow <auj...@gmail.com> wrote:

> When I run the shell, I keep getting errors. Also, I have created the
> question three times now so when I type q.id , I get a return value of 3.
> How can I delete them. Also when I ask the question text (q.question_text)
> I get "<Question: Question object>" instead of the "Whats up".
>
> Any help would be greatly appreciated.
>
> *The error when I run the shell:*
>
> q$ python manage.py shell
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
> RuntimeWarning: Model 'polls.question' was already registered. Reloading
> models is not advised as it can lead to inconsistencies, most notably with
> related models.
>   new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
>
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
> RuntimeWarning: Model 'polls.choice' was already registered. Reloading
> models is not advised as it can lead to inconsistencies, most notably with
> related models.
>   new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
>
> Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/46c118d5-7b70-4575-b714-edf2d05334b3%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/46c118d5-7b70-4575-b714-edf2d05334b3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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

Reply via email to