Re: pub_date timezone

2012-10-25 Thread Emrah Atalay
Hi brendan,

You have the import class before using, so

from polls.models import Poll

2012/10/25 Brendan Carroll 

> Hi all
> I am new to Django and I'm having an issue with some code. I am trying to
> get through the first tutorial from the Django site.
> I have a file called polls/models.py and have created a class that
> contains the following code
> class Poll(models.Model):
>  question = models.CharField(max_length=200)
>  pub_date = models.DateTimeField('date published')
>
> The problem occurs when I go into the command prompt and enter the
> following line
> p = Poll(question = "Whats new? ", pub_date=timezone.now())
> The error is as follows: name Poll is not defined.
> Appreciate any help guidance
>
>
>
> --
> 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/-/dBbvVPL8BicJ.
> 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: pub_date timezone

2012-10-25 Thread Emrah Atalay
Hi again,

Remove 'date published' string from pub_date=models.DateTimeField

from django.db import models

class Poll(models.Model):
question = models.CharField(max_length=200)
put_date = models.DateTimeField()

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes =models.IntegerField()

After that if you not run yet, syncdb

./manage.py

When you open shell import Poll class

from polls.models import Poll



2012/10/25 BrendanC 

> Hi erm
>
> Went back over your comment and realised what you commented.
> After python manage.py I gget the python prompt>>> and then typed
> from polls.models import Poll, Choice
>
> then I typed: Poll.objects.all() and got the array brace [] returned.
> then I typed from django.utils import timezone
>
> then typed: p = Poll(question="Whats new?", pub_date=timezone.now())
> This line will not run and tells me pub_date is an invalid argument.
>
> Thanks again in advance
>
>
> On Thursday, October 25, 2012 2:28:42 PM UTC+1, emr wrote:
>
>> Hi brendan,
>>
>> You have the import class before using, so
>>
>> from polls.models import Poll
>>
>> 2012/10/25 Brendan Carroll 
>>
>>> Hi all
>>> I am new to Django and I'm having an issue with some code. I am trying
>>> to get through the first tutorial from the Django site.
>>> I have a file called polls/models.py and have created a class that
>>> contains the following code
>>> class Poll(models.Model):
>>>  question = models.CharField(max_length=**200)
>>>  pub_date = models.DateTimeField('date published')
>>>
>>> The problem occurs when I go into the command prompt and enter the
>>> following line
>>> p = Poll(question = "Whats new? ", pub_date=timezone.now())
>>> The error is as follows: name Poll is not defined.
>>> Appreciate any help guidance
>>>
>>>
>>>
>>> --
>>> 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/-/**dBbvVPL8BicJ
>>> .
>>> To post to this group, send email to django...@googlegroups.com.
>>> To unsubscribe from this group, send email to django-users...@**
>>> 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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/vZ3ZKc9753QJ.
>
> 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 How to increase the username filed size from 30 to 75

2013-05-25 Thread Emrah Atalay
Hello,

Before sync. import user, and set size

from django.contrib.auth.models import User
User._meta.get_field_by_name('username')[0].max_length = 75
in any model which is in installed_apps list..


2013/5/25 uday kumar g 

> Hi
>
> I am using the User model.
> I want the username to be more than 30 characters.
>
> Is there anyway to change the size from 30 to 75.
>
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.