Re: Problem with Tutorial 1 - Django Version = 1.3

2011-06-30 Thread Cal Leeming [Simplicity Media Ltd]
Hi OP,

Just as a side note, it's probably worth learning about how Python works
before jumping straight into Django. (I'm assuming this based on __unicode__
did not have proper indentation).

My apologies if I am wrong though!

Cal

On Thu, Jun 30, 2011 at 3:19 PM, Jarilyn Hernandez  wrote:

> Thanks for your responses. The problem was solved.
>
> Best Regards,
>
> Eiram
>
>
> On Thu, Jun 30, 2011 at 10:06 AM, Jirka Vejrazka  > wrote:
>
>> > class Poll(models.Model):
>> >question = models.CharField(max_length=200)
>> >pub_date = models.DateTimeField('date published')
>> > def __unicode__(self):
>> >return self.question
>> >
>> > class Choice(models.Model):
>> >poll = models.ForeignKey(Poll)
>> >choice = models.CharField(max_length=200)
>> >votes = models.IntegerField()
>> > def __unicode__(self):
>> >return self.choice
>> >
>> > When I execute the command Poll(objetcs.all): I get as result the
>> > following: class [, ] when I;m
>> > supposed to get as result []
>> >
>> > I don't know what is missing. If someone can help me I would
>> > appreciate it. Thanks!!
>>
>>   Apart from the problem Kenneth pointed out, you seem to have the
>> indentation wrong. The "def __unicode__" belongs to the class, not on
>> the same level as the "class" word.
>>
>>  Cheers
>>
>>Jirka
>>
>> --
>> 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.
>>
>>
>
>
> --
> Jarilyn M. Hernández
> MS Computer Science
> Polytechnic University of Puerto Rico
> Tel: (787) 408-6637
>
>  --
> 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: Problem with Tutorial 1 - Django Version = 1.3

2011-06-30 Thread Jarilyn Hernandez
Thanks for your responses. The problem was solved.

Best Regards,

Eiram

On Thu, Jun 30, 2011 at 10:06 AM, Jirka Vejrazka
wrote:

> > class Poll(models.Model):
> >question = models.CharField(max_length=200)
> >pub_date = models.DateTimeField('date published')
> > def __unicode__(self):
> >return self.question
> >
> > class Choice(models.Model):
> >poll = models.ForeignKey(Poll)
> >choice = models.CharField(max_length=200)
> >votes = models.IntegerField()
> > def __unicode__(self):
> >return self.choice
> >
> > When I execute the command Poll(objetcs.all): I get as result the
> > following: class [, ] when I;m
> > supposed to get as result []
> >
> > I don't know what is missing. If someone can help me I would
> > appreciate it. Thanks!!
>
>   Apart from the problem Kenneth pointed out, you seem to have the
> indentation wrong. The "def __unicode__" belongs to the class, not on
> the same level as the "class" word.
>
>  Cheers
>
>Jirka
>
> --
> 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.
>
>


-- 
Jarilyn M. Hernández
MS Computer Science
Polytechnic University of Puerto Rico
Tel: (787) 408-6637

-- 
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: Problem with Tutorial 1 - Django Version = 1.3

2011-06-30 Thread Jirka Vejrazka
> class Poll(models.Model):
>    question = models.CharField(max_length=200)
>    pub_date = models.DateTimeField('date published')
> def __unicode__(self):
>        return self.question
>
> class Choice(models.Model):
>    poll = models.ForeignKey(Poll)
>    choice = models.CharField(max_length=200)
>    votes = models.IntegerField()
> def __unicode__(self):
>        return self.choice
>
> When I execute the command Poll(objetcs.all): I get as result the
> following: class [, ] when I;m
> supposed to get as result []
>
> I don't know what is missing. If someone can help me I would
> appreciate it. Thanks!!

  Apart from the problem Kenneth pointed out, you seem to have the
indentation wrong. The "def __unicode__" belongs to the class, not on
the same level as the "class" word.

  Cheers

Jirka

-- 
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: Problem with Tutorial 1 - Django Version = 1.3

2011-06-30 Thread Daniel Roseman
Op donderdag 30 juni 2011 14:57:46 UTC+1 schreef Eiram het volgende:
>
> Greetings!! 
>
> In the past few days I have been trying to learn about Django.  I 
> started doing the Tutorial 1. During the tutorial I'm getting a 
> strange error. I was hoping if someone can help me to understand what 
> I'm doing wrong and how can I fix it. 
>
> This is the code I had: 
>
> class Poll(models.Model): 
> question = models.CharField(max_length=200) 
> pub_date = models.DateTimeField('date published') 
> def __unicode__(self): 
> return self.question 
>
> class Choice(models.Model): 
> poll = models.ForeignKey(Poll) 
> choice = models.CharField(max_length=200) 
> votes = models.IntegerField() 
> def __unicode__(self): 
> return self.choice 
>
> When I execute the command Poll(objetcs.all): I get as result the 
> following: class [, ] when I;m 
> supposed to get as result [] 
>
> I don't know what is missing. If someone can help me I would 
> appreciate it. Thanks!! 
>
>
Indentation! Both `def __unicode__` lines need to be at the same level as 
the lines above them.
--
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/-/-eTqM61-4OwJ.
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: Problem with Tutorial 1 - Django Version = 1.3

2011-06-30 Thread Kenneth Gonsalves
On Thu, 2011-06-30 at 06:57 -0700, Eiram wrote:
> Poll(objetcs.all)

Poll.objects.all()
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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: problem with tutorial

2011-02-08 Thread Tom Evans
On Tue, Feb 8, 2011 at 2:43 PM, Szabo, Patrick (LNG-VIE)
 wrote:
>  Hi,
>
> I startet exploring django today and I'm currently stuck.
> Right now I'm doing the 3 part of the tutorial, where it says Design
> your URLs.
>
> I editet the urls.py so it looks like this:
>
> from django.conf.urls.defaults import *
>
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>    (r'^polls/$', 'polls.views.index'),
>    (r'^polls/(?P\d+)/$', 'polls.views.detail'),
>    (r'^polls/(?P\d+)/results/$', 'polls.views.results'),
>    (r'^polls/(?P\d+)/vote/$', 'polls.views.vote'),
>    (r'^admin/', include(admin.site.urls)),
> )
>
> Now if i go tho http://localhost:8000/polls/ i get the following error:
>
>
> AttributeError: 'AdminSite' object has no attribute 'urls'
>
> Can anyone tell me what i did wrong ?!
>
> Kind regards
>

I think you have installed Django 1.0 and are following the tutorial
for Django 1.2.

Can you check? Follow this example:


> $ python manage.py shell
Python 2.6.6 (r266:84292, Oct 20 2010, 10:09:04)
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import django
>>> django.VERSION
(1, 2, 3, 'final', 0)


Cheers

Tom

-- 
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: Problem with Tutorial

2008-05-08 Thread Martin Diers

On May 8, 2008, at 7:39 AM, Boodlooder wrote:

>
> I'm logged in as root, trying to execute:
>
> python mange.py syncdb
>
> the command is returning:
>
...
>super(Connection, self).__init__(*args, **kwargs2)
> _mysql_exceptions.OperationalError: (1049, "Unknown database
> 'reinhardt'")
>
> When I check MySQL for the db, I only have the default MySQL db's.  I
> am new to python, but have extensive programming experience.

syncdb does not create the database for you, except with SQLite.

In MySQL you need to create the DB, and possibly assign it a username  
and password with a GRANT ALL command.

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