Going throught the Django tutorial help pls

2014-08-01 Thread Michael Carey
I have:

Enter code here...from django.shortcuts import render
from django.template import RequestContext, loader
from django.http import HttpResponse

from polls.models import Poll

def index(request):
latest_poll_list = Poll.objects.get(name="Test") 
#Poll.objects.all().order_by('-pub_date')[:5] 
   context = {'latest_poll_list': latest_poll_list}
return render(request, 'polls/index.html', context)

def detail(request, poll_id):
try:
poll = Poll.objects.get(pk=poll_id)
except Poll.DoesNotExist:
raise Http404
return render(request, 'polls/detail.html', {'poll': poll})

def results(request, poll_id):
return HttpResponse("You're looking at the results of poll %s." % 
poll_id)

def vote(request, poll_id):
return HttpResponse("You're voting on poll %s." % poll_id)

It currently shows a list of the polls, what I am trying to work out is how 
to print out the integer value that is associated with that pole.

latest_poll_list = Poll.objects.get(name="Test")


Thankyou

MC

-- 
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/172c763e-fc5c-42d5-8429-eb0643fdcdab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Going throught the Django tutorial help pls

2014-08-01 Thread Michael Carey


On Saturday, 2 August 2014 12:55:25 UTC+10, Collin Anderson wrote:
>
> It currently shows a list of the polls, what I am trying to work out is 
>> how to print out the integer value that is associated with that pole.
>
>
> Is poll.id what you want? In the template it would be {{ poll.id }}
>
> Or: Poll.objects.get(name="Test").id
>

So I tried:

def index(request):
latest_poll_list = Poll.objects.get(name="Test").id 
#Poll.objects.all().order_by('-pub_date')[:5] 
  
context = {'latest_poll_list': latest_poll_list}
return render(request, 'polls/index.html', context)

 and get a error, sorry I am really new to both python and SQLite

I do have a poll "Test" 

Thank you

Mick C

-- 
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/850a42a7-eebd-44f1-a2bf-e1bcabc0c952%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Going throught the Django tutorial help pls

2014-08-02 Thread Michael Carey
FieldError at /polls/

Cannot resolve keyword 'name' into field. Choices are: choice, id, pub_date, 
question

   


  
  




  
  




  
  



  
  


  
  


  
  


  
  Request Method:GETRequest URL:http://127.0.0.1:8000/polls/Django 
Version:1.6.5Exception Type:FieldErrorException Value:

Cannot resolve keyword 'name' into field. Choices are: choice, id, pub_date, 
question

Exception 
Location:/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py 
in names_to_path, line 1283Python Executable:/usr/bin/pythonPython Version:
2.7.6Python Path:

['/home/michael/workspace/new/mysite',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gst-0.10',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/pymodules/python2.7',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

Server time:Sat, 2 Aug 2014 19:20:54 +

Thank you

Michael C

On Sunday, 3 August 2014 00:27:53 UTC+10, Collin Anderson wrote:
>
> What does the error say?
>

-- 
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/3af5d757-f76c-40ac-ab54-f2ff64aa69c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


I have created an app (total noob question)

2014-08-31 Thread Michael Carey
I have created an app, and it works on the test server (port 8000). I 
cannot work out which files to upload to my website to veiw the page?

Thank you,

Michael Carey

-- 
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/9639cab8-49e3-414c-a8a9-714940ff7628%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I have created an app (total noob question)

2014-08-31 Thread Michael Carey
That is assuming that you just upload the files?

On Monday, 1 September 2014 14:26:07 UTC+10, Michael Carey wrote:
>
> I have created an app, and it works on the test server (port 8000). I 
> cannot work out which files to upload to my website to veiw the page?
>
> Thank you,
>
> Michael Carey
>

-- 
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/ce1f1efb-5cfd-42e9-94fa-25628b30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Another Noob questions

2014-09-01 Thread Michael Carey
So I followed a tutorial on graphing a graph in Django.

I have the urls page set up, do I need a index.html?

Thank you,

MC

-- 
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/b1b46d48-d0cf-4da9-8801-8b240138a7c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Another Noob questions

2014-09-01 Thread Michael Carey
I have created an app and have content showing under (mysite)/graph but I 
am not getting a home page.

I have pushed it to git and am not getting a response.

on the dev server (port8000) it shows.

Thank you,

Michael Carey

On Tuesday, 2 September 2014 10:18:21 UTC+10, Michael Carey wrote:
>
> So I followed a tutorial on graphing a graph in Django.
>
> I have the urls page set up, do I need a index.html?
>
> Thank you,
>
> MC
>

-- 
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/bf8db954-d4a0-45d9-bc28-d903d5557bd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Another Noob questions

2014-09-01 Thread Michael Carey
No I didnt have a url(r'^$', views.home_page),

I have pushed the site to git and am trying to view it on git for a start.



On Tuesday, 2 September 2014 10:18:21 UTC+10, Michael Carey wrote:
>
> So I followed a tutorial on graphing a graph in Django.
>
> I have the urls page set up, do I need a index.html?
>
> Thank you,
>
> MC
>

-- 
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/8d91a2a3-343f-4424-b9ad-4e0b6de0f509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.