Re: Django Book

2012-04-12 Thread Sami Balbaky
Hi Tim,

I'm also a fairly new developer in Django, and I found that reading the
book, specifically chapters 1-10, really gave me a solid foundation.
Reading the book in conjunction with https://docs.djangoproject.com/en/1.4/
will give you a very solid footing.

Best,

SB

On Thu, Apr 12, 2012 at 1:09 AM, Torsten Bronger <
bron...@physik.rwth-aachen.de> wrote:

> Hallöchen!
>
> Timothy Makobu writes:
>
> > The Django book is the best source of understanding Django I have
> > found http://www.djangobook.com/en/2.0/
>
> All books about Django share the same problem: The original
> documentation is simply terrific, both for the beginner and the
> expert.
>
> Tschö,
> Torsten.
>
> --
> Torsten BrongerJabber ID: torsten.bron...@jabber.rwth-aachen.de
>  or http://bronger-jmp.appspot.com
>
> --
> 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.



Re: In views.py snippet of Code

2012-03-15 Thread Sami Balbaky
Thank you Kevin, problem solved. I'm actually reading the book from
www.djangobook.com. I need to cross reference with the documentation on
www.thedjangoproject.com.

Best,

SB

On Thu, Mar 15, 2012 at 11:43 AM, Kevin Wetzels <ke...@roam.be> wrote:

>
>
> On Thursday, March 15, 2012 7:32:53 PM UTC+1, Django_for_SB wrote:
>>
>> Hi All,
>>
>> I'm using render_to_response() in my views.py module. And of course,
>> I've imported the method:
>>
>> "from django.shortcuts import render_to_response"
>>
>> # This is the code that's generating the error:
>> def hours_ahead(request, offset):
>> try:
>> offset = int(offset)
>> except ValueError:
>> raise Http404()
>> dt = datetime.datetime.now() + datetime.timedelta(hours =
>> offset)
>> return render_to_response('hours_**ahead.html', {'hour_offset':
>> offset}, {'next_time': dt})
>>
>>
>> Django is complaining that my "render_to_response()" statement is
>> wrong with the following debug statement:
>>
>> "pop expected at least 1 arguments, got 0"
>>
>> Here is the full traceback:
>>
>>
>> Traceback:
>> File "C:\Python27\lib\site-**packages\django\core\handlers\**base.py" in
>> get_response
>>   111. response = callback(request,
>> *callback_args, **callback_kwargs)
>> File "C:\Python27\my_Djando_**projects\HelloWorld\..\**HelloWorld
>> \views.py" in hours_ahead
>>   31. return render_to_response('hours_**ahead.html',
>> {'hour_offset': offset}, {'next_time': dt})
>> File "C:\Python27\lib\site-**packages\django\shortcuts\__**init__.py" in
>> render_to_response
>>   20. return HttpResponse(loader.render_to_**string(*args,
>> **kwargs), **httpresponse_kwargs)
>> File "C:\Python27\lib\site-**packages\django\template\**loader.py" in
>> render_to_string
>>   190. context_instance.pop()
>>
>> Exception Type: TypeError at /time/plus/3/
>> Exception Value: pop expected at least 1 arguments, got 0
>>
>>
>>
>>
>>
>>
>> Since I'm still fairly new to Django, I can't quite see what I'm doing
>> incorrectly here. Any assistance would be greatly appreciated. Thank
>> you.
>>
>> Best,
>>
>> SB
>
>
> You're passing in three parameters to render_to_response. The third one is
> expected to be an instance of Context (see
> https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#django.shortcuts.render_to_response),
> but you're passing in a dictionary.
>
> render_to_response('hours_ahead.html', {'hour_offset': offset,
> 'next_time': dt}) is what you want.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/2Oq52gruh2cJ.
>
> 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.
>



-- 
Sami Balbaky
System Engineer - Ultrawave Labs

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



Re: Error on Tutorial Part 3 - https://docs.djangoproject.com/en/1.3/intro/tutorial03/

2012-03-02 Thread Sami Balbaky
Thank you for the clarification DR. I finished the beginning tutorial on
djangoproject.com. I'm certainly going to need a lot more practice. I'll
fix my code with your changes.

Best,

SB

On Fri, Mar 2, 2012 at 2:21 PM, Daniel Roseman <dan...@roseman.org.uk>wrote:

> On Friday, 2 March 2012 21:47:54 UTC, Django_for_SB wrote:
>>
>> Thank you everyone for your very insightful and helps remarks. I had 2
>> issues with my code:
>>
>> 1) I didn't properly separate my directory strings with commas and
>> 2) I need to code the directory structure, and the absolute path to the
>> file itself.
>>
>> Here is the correct code from within settings.py:
>>
>> TEMPLATE_DIRS = (
>> # Put strings here, like "/home/html/django_templates" or
>> "C:/www/django/templates".
>> # Always use forward slashes, even on Windows.
>> # Don't forget to use absolute paths, not relative paths.
>> 'C:/Python27/my_Djando_
>> projects/mysite/My_Templates/**admin/base_site.html',
>> 'C:/Python27/my_Djando_**projects/mysite/My_Templates/**
>> admin/index.html',
>> 'C:/Python27/my_Djando_**projects/mysite/My_Templates/'**,
>> )
>>
>
> No, this is *not* correct. It may work, but that's because the first two
> will simply not be found.
>
> You *only* need the last line here (including the comma).
> --
> DR.
>
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/xcPMN9h-SIgJ.
>
> 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.
>



-- 
Sami Balbaky
System Engineer - Ultrawave Labs

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



Re: Error on Tutorial Part 3 - https://docs.djangoproject.com/en/1.3/intro/tutorial03/

2012-03-02 Thread Sami Balbaky
Thank you everyone for your very insightful and helps remarks. I had 2
issues with my code:

1) I didn't properly separate my directory strings with commas and
2) I need to code the directory structure, and the absolute path to the
file itself.

Here is the correct code from within settings.py:

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or
"C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'C:/Python27/my_Djando_
projects/mysite/My_Templates/admin/base_site.html',
'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/index.html',
'C:/Python27/my_Djando_projects/mysite/My_Templates/',
)





On Thu, Mar 1, 2012 at 3:42 PM, Python_Junkie <software.buy.des...@gmail.com
> wrote:

>
>
> On Wednesday, February 29, 2012 2:46:11 PM UTC-5, Django_for_SB wrote:
>>
>> Hello All,
>>
>> I'm going through the tutorial on djangoproject.com, and can't seem to
>> hurdle over this section that reads "Write views that actually do
>> something"
>>
>> Here's the code I have so far, which is directly copied from the
>> tutorial or prescribed by the tutorial:
>>
>> views.py:
>> "from django.template import Context, loader
>> from polls.models import Poll
>> from django.http import HttpResponse
>>
>> def index(request):
>> latest_poll_list = Poll.objects.all().order_by('-**pub_date')[:5]
>> t = loader.get_template('polls/**index.html')
>> c = Context({
>> 'latest_poll_list': latest_poll_list,
>> })
>> return HttpResponse(t.render(c))"
>>
>>
>>
>> settings.py:
>> "...
>> TEMPLATE_DIRS = (
>> # Put strings here, like "/home/html/django_templates" or "C:/www/
>> django/templates".
>> # Always use forward slashes, even on Windows.
>> # Don't forget to use absolute paths, not relative paths.
>> 'C:/Python27/my_Djando_**projects/mysite/My_Templates/**admin/
>> base_site.html'
>> 'C:/Python27/my_Djando_**projects/mysite/My_Templates/**admin/
>> index.html'
>> 'C:/Python27/my_Djando_**projects/mysite/My_Templates/**polls/
>> index.html'
>> )
>> ..."
>>
>>
>> index.html:
>> "{% if latest_poll_list %}
>> 
>> {% for poll in latest_poll_list %}
>> {{ poll.question }}> li>
>> {% endfor %}
>> 
>> {% else %}
>> No polls are available.
>> {% endif %}
>> "
>>
>>
>>
>>
>> I keep getting the same error, which reads:
>>
>>
>> TemplateDoesNotExist at /polls/
>>
>> polls/index.html
>>
>> Request Method: GET
>> Request URL: http://localhost:8000/polls/
>> Django Version: 1.3.1
>> Exception Type: TemplateDoesNotExist
>> Exception Value:
>>
>> polls/index.html
>>
>> Exception Location: C:\Python27\lib\site-**packages\django\template
>>
>> \loader.py in find_template, line 138
>> Python Executable: C:\Python27\python.exe
>> Python Version: 2.7.2
>> Python Path:
>>
>> ['C:\\Python27\\my_Djando_**projects\\mysite',
>>  'C:\\Windows\\system32\\**python27.zip',
>>  'C:\\Python27\\DLLs',
>>  'C:\\Python27\\lib',
>>  'C:\\Python27\\lib\\plat-win'**,
>>  'C:\\Python27\\lib\\lib-tk',
>>  'C:\\Python27',
>>  'C:\\Python27\\lib\\site-**packages']
>>
>> Server time: Wed, 29 Feb 2012 11:32:54 -0800
>> Template-loader postmortem
>>
>> Django tried loading these templates, in this order:
>>
>> Using loader django.template.loaders.**filesystem.Loader:
>> c:\python27\my_djando_**projects\mysite\my_templates\**admin
>> \base_site.html
>> c:\python27\my_djando_**projects\mysite\my_templates\**admin\index.html
>> c:\python27\my_djando_**projects\mysite\my_templates\**polls\index.html
>> \polls\index.html (File does not exist)
>> Using loader django.template.loaders.app_**directories.Loader:
>> c:\python27\lib\site-packages\**django\contrib\admin\**templates\polls
>> \index.html (File does not exist)
>>
>>
>>
>>
>> What on earth am I doing wrong here? I've so many different variations
>> of my settings.py, views.py, and index.html. Any help would be much
>> appreciated.
>>
>>
>> Thanks,
>>
>> SB
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/klXbEFxYWH4J.
>
> 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.
>



-- 
Sami Balbaky
System Engineer - Ultrawave Labs

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



Re: Error on Tutorial Part 3 - https://docs.djangoproject.com/en/1.3/intro/tutorial03/

2012-02-29 Thread Sami Balbaky
Hi Anoop,

Thank you for the kind reply, I've tried that already. Here are the 3
variations that I've attempted so far within settings.py in TEMPLATE_DIRS:

'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/index.html'
'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/'
'C:/Python27/my_Djando_projects/mysite/My_Templates/'


They all yield the same error unfortunately. I'm coding this on a Windows
Vista system, fyi.

Best,

SB

On Wed, Feb 29, 2012 at 11:48 AM, Anoop Thomas Mathew <atm...@gmail.com>wrote:

> You have to give template directories, not template names in the
> settings.py.
> Thanks,
> Anoop
> atm
> ___
> Life is short, Live it hard.
>
>
>
>
>
> On 1 March 2012 01:16, Django_for_SB <sami.balb...@gmail.com> wrote:
>
>> Hello All,
>>
>> I'm going through the tutorial on djangoproject.com, and can't seem to
>> hurdle over this section that reads "Write views that actually do
>> something"
>>
>> Here's the code I have so far, which is directly copied from the
>> tutorial or prescribed by the tutorial:
>>
>> views.py:
>> "from django.template import Context, loader
>> from polls.models import Poll
>> from django.http import HttpResponse
>>
>> def index(request):
>>latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
>>t = loader.get_template('polls/index.html')
>>c = Context({
>>'latest_poll_list': latest_poll_list,
>>})
>>return HttpResponse(t.render(c))"
>>
>>
>>
>> settings.py:
>> "...
>> TEMPLATE_DIRS = (
>># Put strings here, like "/home/html/django_templates" or "C:/www/
>> django/templates".
>># Always use forward slashes, even on Windows.
>># Don't forget to use absolute paths, not relative paths.
>>'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
>> base_site.html'
>>'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
>> index.html'
>>'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/
>> index.html'
>> )
>> ..."
>>
>>
>> index.html:
>> "{% if latest_poll_list %}
>>
>>{% for poll in latest_poll_list %}
>>{{ poll.question }}> li>
>>{% endfor %}
>>
>> {% else %}
>>No polls are available.
>> {% endif %}
>> "
>>
>>
>>
>>
>> I keep getting the same error, which reads:
>>
>>
>> TemplateDoesNotExist at /polls/
>>
>> polls/index.html
>>
>> Request Method: GET
>> Request URL:http://localhost:8000/polls/
>> Django Version: 1.3.1
>> Exception Type: TemplateDoesNotExist
>> Exception Value:
>>
>> polls/index.html
>>
>> Exception Location: C:\Python27\lib\site-packages\django\template
>> \loader.py in find_template, line 138
>> Python Executable:  C:\Python27\python.exe
>> Python Version: 2.7.2
>> Python Path:
>>
>> ['C:\\Python27\\my_Djando_projects\\mysite',
>>  'C:\\Windows\\system32\\python27.zip',
>>  'C:\\Python27\\DLLs',
>>  'C:\\Python27\\lib',
>>  'C:\\Python27\\lib\\plat-win',
>>  'C:\\Python27\\lib\\lib-tk',
>>  'C:\\Python27',
>>  'C:\\Python27\\lib\\site-packages']
>>
>> Server time:Wed, 29 Feb 2012 11:32:54 -0800
>> Template-loader postmortem
>>
>> Django tried loading these templates, in this order:
>>
>> Using loader django.template.loaders.filesystem.Loader:
>> c:\python27\my_djando_projects\mysite\my_templates\admin
>> \base_site.html
>> c:\python27\my_djando_projects\mysite\my_templates\admin\index.html
>> c:\python27\my_djando_projects\mysite\my_templates\polls\index.html
>> \polls\index.html (File does not exist)
>> Using loader django.template.loaders.app_directories.Loader:
>> c:\python27\lib\site-packages\django\contrib\admin\templates\polls
>> \index.html (File does not exist)
>>
>>
>>
>>
>> What on earth am I doing wrong here? I've so many different variations
>> of my settings.py, views.py, and index.html. Any help would be much
>> appreciated.
>>
>>
>> Thanks,
>>
>> SB
>>
>> --
>> 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.
>> F

Re: Calling "manage.py shell" from the Python Shell in Tutorial Part 1

2012-02-27 Thread Sami Balbaky
Thanks everyone. Your inputs were a tremendous help. I'm slowly, but
surely, getting the hang of Django.

Best,

S

On Wed, Feb 22, 2012 at 9:19 AM, Bill Freeman  wrote:

> 1.  There is more information in that traceback (that you didn't
> include) that could help
> you find your indentation error.
>
> 2.  It is quite useful, presuming that you are also a python beginner,
> to do the tutorial
> at:
>
>   http://docs.python.org/tutorial/index.html
>
> Bill
>
> On Tue, Feb 21, 2012 at 6:41 PM, Django_for_SB 
> wrote:
> > Django Gurus,
> >
> > I'm an absolute beginner using Python in Django. I'm currently going
> > through the tutorial, part 1, on the djangoproject.com main website:
> > https://docs.djangoproject.com/en/1.3/intro/tutorial01/. I keep trying
> > to complete part 1 of the tutorial, step by step, meaning, I'll go
> > through the tutorial part 1, progress up to a certain point, then
> > close my shell command and shut-down my computer. Then, when I get
> > back to opening up the project in which I initially began working on,
> > namely, "mysite" (as the tutorial instructs us to name), my shell
> > commands aren't valid anymore.
> >
> > Example:
> >
> > manage.py shell -> This
> > initially works if I start the project from scratch
> >
> > manage.py shell -> This won't
> > work if I leave my project, then go back to continue to
> >
> > work on it later
> >
> > This is the error I keep getting:
> >
> > Traceback(most recent call last):
> >
> > IndentationError: unexpected Indent
> >
> >
> >
> > I'm not quite sure what's going on. Any assistance would be more than
> > appreciated. What am I missing here? Thank you.
> >
> > Best,
> >
> > SB
> >
> > --
> > 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.
>
>

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