Re: loading a typical image to Django 1.3

2011-06-26 Thread Kenny Meyer
What about your urls.py?

Kenny



On Sun, Jun 26, 2011 at 1:15 PM, vahidR  wrote:
> Hi There,
>
> I have a very basic question about adding images to Django 1.3.
> I've almost read the whole documents on adding Static files , searched
> for relevant results both in here and StackOverFlow and still have a
> problem with my case.
>
> Please take a look at my settings :
>
> STATIC_ROOT = '/home/vahid/Aptana3Workspace/djangoshop/djangoShop/
> static'
>
> STATIC_URL = '/static/'
>
> STATICFILES_DIRS = (STATIC_ROOT ,  )
>
> I did the last one to avoid collision between ROOT and DIRS and make
> it more simple to implement the idea.
>
> I have also added some stuff to settings.py as :
>
> STATICFILES_FINDERS = (
>   'django.contrib.staticfiles.finders.FileSystemFinder',
>   'django.contrib.staticfiles.finders.AppDirectoriesFinder',
>   'django.contrib.staticfiles.finders.DefaultStorageFinder',
> )
>
> INSTALLED_APPS = (.
>                                  'django.contrib.staticfiles',
>                                  .
>                                  )
>
>
> But I still have a problem with loading the images (for example:
> logo.jpg)
>
>
> Would you please help me to get it done ??
> What is a simple way to load images in the developing environment ??
>
> --
> 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: Admin User registration problem...

2011-06-16 Thread Kenny Meyer
> i want to create superuser(administrator) on registration
User.objects.create_superuser is your friend.

>             user=User.objects.create_user(
>                 username=form.cleaned_data['username'],
>                 password=form.cleaned_data['password1'],
>                 email=form.cleaned_data['email'],
>                 is_staff=form.cleaned_data['is_staff'],
>             )

Maybe try instead:

user=User.objects.create_superuser(
username=form.cleaned_data['username'],
    password=form.cleaned_data['password1'],
    email=form.cleaned_data['email'],
)

Kenny



On Thu, Jun 16, 2011 at 12:03 PM, ashish tiwari  wrote:
> hi friends,
> i developed an application in django-nonrel with appengine.
> i'm using django forms for user registration.
>
> forms.py
> 
> class RegistrationForm(forms.Form):
>     username=forms.CharField(label=u'Username',max_length=30)
>     email=forms.CharField(label=u'Email')
>     is_staff=forms.BooleanField(label=u'is staff')
>
> password1=forms.CharField(label=u'Password',widget=forms.PasswordInput())
>
> password2=forms.CharField(label=u'Password(Again)',widget=forms.PasswordInput())
> views.py
> 
> def register_page(request):
>     if request.method=='POST':
>         form = RegistrationForm(request.POST)
>         if form.is_valid():
>             user=User.objects.create_user(
>                 username=form.cleaned_data['username'],
>                 password=form.cleaned_data['password1'],
>                 email=form.cleaned_data['email'],
>                 is_staff=form.cleaned_data['is_staff'],
>             )
>         return HttpResponseRedirect('/')
>     else:
>         form=RegistrationForm()
>         variables=RequestContext(request,{'form':form})
>     return
> render_to_response('interview/registration/register.html',variables)
>
> register.html
> ~
>     
>             {{ form.as_p }}
>     
> when i try to register,it throws an error ..
> "create_user() got an unexpected keyword argument 'is_staff'"
> i want to create superuser(administrator) on registration is there
> anything m doing wrong? Thanks in advance
>
> --
> 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/-/4HkVMVqNkJwJ.
> 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: using django on a server?

2011-05-10 Thread Kenny Meyer
>> Could I get the same functionality by just using pythong cgi and python to
>> access mysql? (like php scripting)
>
> Probably; but that is like if you were to ride a monstrous and untamed
> Warhorse, having this cute and little pony which can already do a 100
> tricks. :-)

You will not always need web frameworks. It really depends on what you
want to make.
http://dfhu.org/blog/should-you-use-a-framework

Kenny



On Tue, May 10, 2011 at 5:57 AM, Kenny Meyer  wrote:
>> 1. What is the purpose of using a web framework like django? Could I
>> get the same functionality by just using pythong cgi and python to
>> access mysql? (like php scripting)
> A web application framework is a software framework that is designed
> to support the development of dynamic websites, web applications and
> web services. The framework aims to alleviate the overhead associated
> with common activities performed in Web development. For example, many
> frameworks provide libraries for database access, templating
> frameworks and session management, and they often promote code reuse.
> (Source: Wikipedia)
>
> Django provides libraries for database access, a custom template
> language, forms, sessions and loves the DRY-principle. Other batteries
> included. http://docs.djangoproject.com/en/1.3/#other-batteries-included
>
> It is also incredibly easy to extend Django's capabilities by
> writing/reusing apps for your Django project.
>
>> Could I get the same functionality by just using pythong cgi and python to
>> access mysql? (like php scripting)
>
> Probably; but that is like if you were to ride a monstrous and untamed
> Warhorse, having this cute and little pony which can already do a 100
> tricks. :-)
>
> Kenny
>
>
>
> On Mon, May 9, 2011 at 7:25 PM, raj  wrote:
>> Hey guys,
>>
>> I'm sort of new to the whole web framework idea. I have very good
>> knowledge of python and cgi scripting and I have a few questions about
>> django.
>> 1. What is the purpose of using a web framework like django? Could I
>> get the same functionality by just using pythong cgi and python to
>> access mysql? (like php scripting)
>> 2. If I do use a framework like django, how exactly do I use django on
>> a server? Like I have hosting through ipage. How do I use django on
>> it? If ipage can't handle django scripting, what hosting websites
>> would handle it?
>>
>> Thank you,
>> Sincerely,
>> -Raj Agarwal
>>
>> --
>> 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: using django on a server?

2011-05-10 Thread Kenny Meyer
> 1. What is the purpose of using a web framework like django? Could I
> get the same functionality by just using pythong cgi and python to
> access mysql? (like php scripting)
A web application framework is a software framework that is designed
to support the development of dynamic websites, web applications and
web services. The framework aims to alleviate the overhead associated
with common activities performed in Web development. For example, many
frameworks provide libraries for database access, templating
frameworks and session management, and they often promote code reuse.
(Source: Wikipedia)

Django provides libraries for database access, a custom template
language, forms, sessions and loves the DRY-principle. Other batteries
included. http://docs.djangoproject.com/en/1.3/#other-batteries-included

It is also incredibly easy to extend Django's capabilities by
writing/reusing apps for your Django project.

> Could I get the same functionality by just using pythong cgi and python to
> access mysql? (like php scripting)

Probably; but that is like if you were to ride a monstrous and untamed
Warhorse, having this cute and little pony which can already do a 100
tricks. :-)

Kenny



On Mon, May 9, 2011 at 7:25 PM, raj  wrote:
> Hey guys,
>
> I'm sort of new to the whole web framework idea. I have very good
> knowledge of python and cgi scripting and I have a few questions about
> django.
> 1. What is the purpose of using a web framework like django? Could I
> get the same functionality by just using pythong cgi and python to
> access mysql? (like php scripting)
> 2. If I do use a framework like django, how exactly do I use django on
> a server? Like I have hosting through ipage. How do I use django on
> it? If ipage can't handle django scripting, what hosting websites
> would handle it?
>
> Thank you,
> Sincerely,
> -Raj Agarwal
>
> --
> 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: DateTime in Django (Help)

2011-05-09 Thread Kenny Meyer
Oh! I have found a precious discussion on SO.
http://stackoverflow.com/questions/38601/using-django-time-date-widgets-in-custom-form

I think you might like the highest-voted solution.

Kenny



On Mon, May 9, 2011 at 9:28 PM, Kenny Meyer  wrote:
> s/sting/string
>
> On Mon, May 9, 2011 at 9:27 PM, Kenny Meyer  wrote:
>>> However, I keep getting validating errors with datetime, probably is
>>> how I am entering the data. I have also tried the SplitDateTimeWidget
>>> I am getting the same
>>> validation error
>> These are the valid input formats:
>> http://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.DateTimeField.input_formats
>>
>> Check if they look like the sting you are feeding your form input with.
>>
>> If you still keep getting validation errors, it would be nice if you
>> could attach the stack trace in a reply to this mail.
>>
>> Kenny
>>
>>
>> On Mon, May 9, 2011 at 12:36 PM, Kevin Miller  wrote:
>>> Thanks so much for your response. I have done all that and I have
>>> model forms working for other models.
>>> However, I keep getting validating errors with datetime, probably is
>>> how I am entering the data. I have also tried the SplitDateTimeWidget
>>> I am getting the same
>>> validation error. I have tried manually creating  the form and it
>>> worked. I wonder what is the normally approach to DateTimeField in
>>> django templates. Is using the
>>> SplitDateTimeWidget the norm or should I use the AdminDateTimeWidget ?
>>>
>>> Thanks again.
>>>
>>>
>>>
>>> On Mon, May 9, 2011 at 11:11 AM, Kenny Meyer  wrote:
>>>> On Mon, May 9, 2011 at 10:55 AM, Kevin Miller  
>>>> wrote:
>>>>> Dear all,
>>>>>
>>>>> I am new to django but is in the process of building my first website. I 
>>>>> have
>>>>> been ok for a while as I am not new to programming in python. However, I 
>>>>> have
>>>>> one problem that I cannot figure out the proper way to do it. I want to 
>>>>> use
>>>>> ModelForm but have a DateTime Field. I can do it without using a 
>>>>> ModelForm but
>>>>> I think using the ModelForm is the proper way to do it.
>>>>
>>>> What's the problem with the DateTimeField in a model?
>>>>
>>>>> Can someone show me a small example of using ModelForm with DateTime 
>>>>> field?
>>>>> How can can the DateTime field me displayed in django templates?
>>>>
>>>> in your models.py:
>>>>
>>>> class Foo(models.Model):
>>>>    datetime = models.DateTimeField()
>>>>
>>>> class FooForm(forms.ModelForm):
>>>>    class Meta:
>>>>        model = Foo
>>>>
>>>>
>>>> in your views.py:
>>>>
>>>> def bar(request):
>>>>    form = FooForm()
>>>>    return render_to_response("bar.html", {"form": form})
>>>>
>>>>
>>>> in template bar.html:
>>>>
>>>>    {{ foo }}
>>>>
>>>>
>>>> There's absolutely nothing special here :) .
>>>>
>>>> If you couldn't understand some of the code, then you should read the
>>>> documentation .
>>>> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/
>>>>
>>>> --
>>>> 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.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Kevin Miller
>>> Acting Data Controller
>>> Department of Computing
>>> UWI, Mona
>>> Kingston 7
>>>
>>> --
>>> 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: DateTime in Django (Help)

2011-05-09 Thread Kenny Meyer
s/sting/string

On Mon, May 9, 2011 at 9:27 PM, Kenny Meyer  wrote:
>> However, I keep getting validating errors with datetime, probably is
>> how I am entering the data. I have also tried the SplitDateTimeWidget
>> I am getting the same
>> validation error
> These are the valid input formats:
> http://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.DateTimeField.input_formats
>
> Check if they look like the sting you are feeding your form input with.
>
> If you still keep getting validation errors, it would be nice if you
> could attach the stack trace in a reply to this mail.
>
> Kenny
>
>
> On Mon, May 9, 2011 at 12:36 PM, Kevin Miller  wrote:
>> Thanks so much for your response. I have done all that and I have
>> model forms working for other models.
>> However, I keep getting validating errors with datetime, probably is
>> how I am entering the data. I have also tried the SplitDateTimeWidget
>> I am getting the same
>> validation error. I have tried manually creating  the form and it
>> worked. I wonder what is the normally approach to DateTimeField in
>> django templates. Is using the
>> SplitDateTimeWidget the norm or should I use the AdminDateTimeWidget ?
>>
>> Thanks again.
>>
>>
>>
>> On Mon, May 9, 2011 at 11:11 AM, Kenny Meyer  wrote:
>>> On Mon, May 9, 2011 at 10:55 AM, Kevin Miller  
>>> wrote:
>>>> Dear all,
>>>>
>>>> I am new to django but is in the process of building my first website. I 
>>>> have
>>>> been ok for a while as I am not new to programming in python. However, I 
>>>> have
>>>> one problem that I cannot figure out the proper way to do it. I want to use
>>>> ModelForm but have a DateTime Field. I can do it without using a ModelForm 
>>>> but
>>>> I think using the ModelForm is the proper way to do it.
>>>
>>> What's the problem with the DateTimeField in a model?
>>>
>>>> Can someone show me a small example of using ModelForm with DateTime field?
>>>> How can can the DateTime field me displayed in django templates?
>>>
>>> in your models.py:
>>>
>>> class Foo(models.Model):
>>>    datetime = models.DateTimeField()
>>>
>>> class FooForm(forms.ModelForm):
>>>    class Meta:
>>>        model = Foo
>>>
>>>
>>> in your views.py:
>>>
>>> def bar(request):
>>>    form = FooForm()
>>>    return render_to_response("bar.html", {"form": form})
>>>
>>>
>>> in template bar.html:
>>>
>>>    {{ foo }}
>>>
>>>
>>> There's absolutely nothing special here :) .
>>>
>>> If you couldn't understand some of the code, then you should read the
>>> documentation .
>>> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>>
>> --
>> Kevin Miller
>> Acting Data Controller
>> Department of Computing
>> UWI, Mona
>> Kingston 7
>>
>> --
>> 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: DateTime in Django (Help)

2011-05-09 Thread Kenny Meyer
> However, I keep getting validating errors with datetime, probably is
> how I am entering the data. I have also tried the SplitDateTimeWidget
> I am getting the same
> validation error
These are the valid input formats:
http://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.DateTimeField.input_formats

Check if they look like the sting you are feeding your form input with.

If you still keep getting validation errors, it would be nice if you
could attach the stack trace in a reply to this mail.

Kenny


On Mon, May 9, 2011 at 12:36 PM, Kevin Miller  wrote:
> Thanks so much for your response. I have done all that and I have
> model forms working for other models.
> However, I keep getting validating errors with datetime, probably is
> how I am entering the data. I have also tried the SplitDateTimeWidget
> I am getting the same
> validation error. I have tried manually creating  the form and it
> worked. I wonder what is the normally approach to DateTimeField in
> django templates. Is using the
> SplitDateTimeWidget the norm or should I use the AdminDateTimeWidget ?
>
> Thanks again.
>
>
>
> On Mon, May 9, 2011 at 11:11 AM, Kenny Meyer  wrote:
>> On Mon, May 9, 2011 at 10:55 AM, Kevin Miller  wrote:
>>> Dear all,
>>>
>>> I am new to django but is in the process of building my first website. I 
>>> have
>>> been ok for a while as I am not new to programming in python. However, I 
>>> have
>>> one problem that I cannot figure out the proper way to do it. I want to use
>>> ModelForm but have a DateTime Field. I can do it without using a ModelForm 
>>> but
>>> I think using the ModelForm is the proper way to do it.
>>
>> What's the problem with the DateTimeField in a model?
>>
>>> Can someone show me a small example of using ModelForm with DateTime field?
>>> How can can the DateTime field me displayed in django templates?
>>
>> in your models.py:
>>
>> class Foo(models.Model):
>>    datetime = models.DateTimeField()
>>
>> class FooForm(forms.ModelForm):
>>    class Meta:
>>        model = Foo
>>
>>
>> in your views.py:
>>
>> def bar(request):
>>    form = FooForm()
>>    return render_to_response("bar.html", {"form": form})
>>
>>
>> in template bar.html:
>>
>>    {{ foo }}
>>
>>
>> There's absolutely nothing special here :) .
>>
>> If you couldn't understand some of the code, then you should read the
>> documentation .
>> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/
>>
>> --
>> 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.
>>
>>
>
>
>
> --
> Kevin Miller
> Acting Data Controller
> Department of Computing
> UWI, Mona
> Kingston 7
>
> --
> 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: DateTime in Django (Help)

2011-05-09 Thread Kenny Meyer
On Mon, May 9, 2011 at 10:55 AM, Kevin Miller  wrote:
> Dear all,
>
> I am new to django but is in the process of building my first website. I have
> been ok for a while as I am not new to programming in python. However, I have
> one problem that I cannot figure out the proper way to do it. I want to use
> ModelForm but have a DateTime Field. I can do it without using a ModelForm but
> I think using the ModelForm is the proper way to do it.

What's the problem with the DateTimeField in a model?

> Can someone show me a small example of using ModelForm with DateTime field?
> How can can the DateTime field me displayed in django templates?

in your models.py:

class Foo(models.Model):
datetime = models.DateTimeField()

class FooForm(forms.ModelForm):
class Meta:
model = Foo


in your views.py:

def bar(request):
form = FooForm()
return render_to_response("bar.html", {"form": form})


in template bar.html:

{{ foo }}


There's absolutely nothing special here :) .

If you couldn't understand some of the code, then you should read the
documentation .
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/

-- 
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: Best practice for async task in django?

2011-05-06 Thread Kenny Meyer
Look at the Celery project ( http://celeryproject.org/ ) to be sure it
fits your needs. You can easily integrate with Django by using
https://github.com/ask/django-celery .

You could also use a signal, listening for a request_finished, which
will run the task inside a Thread. Here's a concrete example of that:
http://www.artfulcode.net/articles/threading-django/ .

Kenny



2011/5/6 λq :
> Hi guys,
>
> We have a django product running, one of the view is to track each
> request of news and write to MySQL, so when user grows the track
> read/write became heavy and it may take a while for the user to get a
> response. So we are thinking about something like async worker process
> to do the MySQL write task but give the client a quick response first.
> Something like a Message Queue. What is currently the best practice
> for Django 1.2 for these kind of stuff?
>
> Thanks in advance.
>
> Regards,
>
> λq
>
> --
> 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: form input

2011-04-30 Thread Kenny Meyer
As a newbie I recommend you taking the Django tutorial. Here's the
part about forms:
http://docs.djangoproject.com/en/dev/intro/tutorial04/

Kenny



On Sat, Apr 30, 2011 at 7:24 PM, Pulkit Mehrotra
 wrote:
> can anyone tell me the precise way of taking an input from a form and
> storing it in a database
> or provide a good link where i can find one
>
> i am a newbie so please help me
>
> thank you
>
> --
> 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: Print "flash" messages in templates for certain levels

2011-04-30 Thread Kenny Meyer
> Or is there other better solution?
I think you should handle this in the view, like checking there if the
user has sufficient privileges for seeing the message.

Kenny

-- 
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: Custom template tag -- Not registered?

2011-04-29 Thread Kenny Meyer
On Fri, Apr 29, 2011 at 5:11 PM, Daniel Roseman  wrote:
> On Friday, 29 April 2011 21:24:44 UTC+1, Kenny Meyer wrote:
>>
>> Hello,
>>
>> I have the following inclusion tag in templatetags/show_submissions.py :
>>
>> ## BOF
>>
>> register = template.Library()
>>
>> @register.inclusion_tag('competition/templatetags/show_submissions.html')
>> def show_submissions(participant):
>>     submissions = Submission.objects.get(participant=participant)
>>     return {"submissions": submissions}
>>
>> ## EOF
>>
>> Whenever Django reaches the following line in my templates:
>>
>>     {% show_submissions user.participant %}
>>
>> A TemplateSyntaxError gets raised, which I interpret as "I don't find
>> your templatetag". Here's the full traceback:
>> http://dpaste.com/537298/
>>
>> Observations:
>> * Restarted the dev server several times after registering the tag,
>> and got the same results.
>> * templatetags/ folder has a __init__.py
>> * Using Django 1.3
>>
>> Any ideas why I cannot use this inclusion tag?
>>
>> Kenny
>
> Your template doesn't seem to have {% load show_submissions %} anywhere.

Oh, I really forgot that... there was indeed no {% load
show_submissions %} anywhere.

Thanks for your kind help!

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



Custom template tag -- Not registered?

2011-04-29 Thread Kenny Meyer
Hello,

I have the following inclusion tag in templatetags/show_submissions.py :

## BOF

register = template.Library()

@register.inclusion_tag('competition/templatetags/show_submissions.html')
def show_submissions(participant):
submissions = Submission.objects.get(participant=participant)
return {"submissions": submissions}

## EOF

Whenever Django reaches the following line in my templates:

{% show_submissions user.participant %}

A TemplateSyntaxError gets raised, which I interpret as "I don't find
your templatetag". Here's the full traceback:
http://dpaste.com/537298/

Observations:
* Restarted the dev server several times after registering the tag,
and got the same results.
* templatetags/ folder has a __init__.py
* Using Django 1.3

Any ideas why I cannot use this inclusion tag?

Kenny

-- 
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: inlineformset_factory and many-to-many relationships

2011-04-27 Thread Kenny Meyer
Hi Rosemarie,

Try a quick google search with terms like "django  has no ForeignKey to " and you'll get a bunch of results. I promise.

Here's only one of those results:
http://stackoverflow.com/questions/609556/django-admin-inlining-foreign-key-issue

AFAICS this issue has been discussed various times here on this
mailing-list. Again, Google search engine is an awesome thing :)

Kenny



On Wed, Apr 27, 2011 at 4:47 PM, Rosemarie
 wrote:
> Oh yeah, and the exact error I am currently getting is
> Exception at /members/edit/
>  has no ForeignKey to  'member.models.member'>
>
> --
> 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: Running tests automatically as you work.

2011-04-27 Thread Kenny Meyer
Thanks for sharing! Very useful, indeed.

The sleep() in your script is pretty clever, as I also tend to save
files pretty frequently.


On Wed, Apr 27, 2011 at 5:58 PM, Shawn Milochik  wrote:
> http://dpaste.com/hold/536487/
>
> I cobbled this little script together that monitors my project folder and
> runs tests every time a .py file is saved. I'm sharing it in case anyone is
> interested. Feedback is welcome, of course.
>
> Interesting bits:
>
>    pyinotify: This module plugs into kernel notifications so you don't have
> to do something horrible like put os.walk in a loop.
>
>    call_command: Kenny Meyer pointed this out to me. It lets you run
> 'manage.py' commands from a Python script.
> http://docs.djangoproject.com/en/dev/ref/django-admin/#running-management-commands-from-your-code
>
>    SystemExit: When sys.exit() is called, you can't catch it with "except
> Exception," because it has a different base class.
>        Thanks to Alex Gaynor for helping me with this one.
>
> --
> 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: Running Django tests from Python

2011-04-27 Thread Kenny Meyer
Hi Shawn,

http://docs.djangoproject.com/en/dev/ref/django-admin/#running-management-commands-from-your-code

Does this answer your question?

Kenny



On Wed, Apr 27, 2011 at 12:41 PM, Shawn Milochik  wrote:
> Sorry, I realize that last post is missing the context of the original
> question.
> Please see
> this: https://groups.google.com/d/topic/django-users/-4f3J1bJ10k/discussion
> Thanks,
> Shawn
>
> --
> 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: User Profile and Form initial values

2011-04-26 Thread Kenny Meyer
On Tue, Apr 26, 2011 at 4:17 PM, Shawn Milochik  wrote:
> If you're creating a ModelForm that already has data in the database, don't
> pass in request.POST. Instead, pass in the instance with the 'instance'
> keyword argument.
>
> For example, if it was a ModelForm for the User object: form =
> UserForm(instance = request.user)
Thanks, I had the same question and passing an instance worked fine
for me. Isn't this documented somewhere?

-- 
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: Checking for user type in view

2011-04-24 Thread Kenny Meyer
On Sun, Apr 24, 2011 at 5:23 PM, Shawn Milochik  wrote:
> It's not recommended that you subclass User.
>
> Better: Create a class to use for a user profile and associate it with
> the User using the instructions here:
>
> http://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users

I should have read that section before. This is much better in the long run.

Thanks, Shawn.

-- 
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: Checking for user type in view

2011-04-24 Thread Kenny Meyer
> I have done the following, and it works most of the time for me:
>
> def index(request):
>    user = request.user
>    if user.is_authenticated():
>        if user.is_superuser:
>            return redirect('/admin')
>
>        judge = None
>        participant = None
>        competition = None
>        try:
>            participant = user.participant or None
>            judge = user.judge or None
>            if participant:
>                competition = participant.competition
>            if judge:
>                competition = judge.competition
>        except Participant.DoesNotExist, e:
>            pass
>        except Judge.DoesNotExist, e:
>            pass
>        except Exception, e:
>            raise
>    # Do some more stuff...

Actually this *doesn't* work most of the time for me, because the
moment user.participant raises an exception I'm screwed.

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



Checking for user type in view

2011-04-24 Thread Kenny Meyer
Hello guys,

In my application models I have two models, Judge and Participant:

  from django.contrib.auth.models import User

  class Judge(User):
  pass

  class Participant(User):
  pass

In my view I want to find out if the authenticated user is either a
Judge or a Participant. How can I do that?


I have done the following, and it works most of the time for me:

def index(request):
user = request.user
if user.is_authenticated():
if user.is_superuser:
return redirect('/admin')

judge = None
participant = None
competition = None
try:
participant = user.participant or None
judge = user.judge or None
if participant:
competition = participant.competition
if judge:
competition = judge.competition
except Participant.DoesNotExist, e:
pass
except Judge.DoesNotExist, e:
pass
except Exception, e:
raise
# Do some more stuff...

But this is ugly. It would be cool if you could come up with better ideas.


Kenny

-- 
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: Unicode translation problem

2011-04-22 Thread Kenny Meyer
On Fri, Apr 22, 2011 at 4:22 PM, John Maines  wrote:
> Hello,
>
> I am going through the Django Tutorials on the Django home page. All
> has gone fine, except one thing:
>
> When building the admin page, I can't get the unicode translator to
> work. It is supposed to change "Poll: Poll object" to readable text.
> It just doesn't work. I am using PostgreSQL set for UTF8 encoding.
> Running on Windows.
>
> Any ideas? Thank you.

The problem you are trying to solve is not clear to me. Reformulate
your question, please.

> Here are the instructions that fail:
>
> "Wait a minute.  is, utterly, an unhelpful
> representation of this object. Let's fix that by editing the polls
> model (in the polls/models.py file) and adding a __unicode__() method
> to both Poll and Choice:"

Check out what the __unicode__() method is all about:
http://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#unicode

For general information of Unicode support in Django you may find here:
http://docs.djangoproject.com/en/dev/ref/unicode/

>
> class Poll(models.Model):
>    # ...
>    def __unicode__(self):
>        return self.question
>
> class Choice(models.Model):
>    # ...
>    def __unicode__(self):
>        return self.choice
>
> --
> 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: Extremely Frustrated

2011-04-21 Thread Kenny Meyer
Can you give us the following information:
 - Django version installed on your system
 - Full tracebacks, not just what type of Exception has been thrown.

Please?

Kenny



On Thu, Apr 21, 2011 at 4:00 PM, Gandeida  wrote:
> Hello,
>
> I have been working through the Django Book, and I keep getting syntax
> errors in the examples in Chapter 6.
>
> The following example works:
>
> class BookAdmin(admin.ModelAdmin):
>    list_display = ('title', 'publisher', 'publication_date')
>    list_filter = ('publication_date',)
>    date_hierarchy = 'publication_date'
>    ordering = ('-publication_date',)
>    fields = ('title', 'authors', 'publisher', 'publication_date')
>
> The next one, however, does not - it throws a syntax error:
>
> class BookAdmin(admin.ModelAdmin):
>    list_display = ('title', 'publisher', 'publication_date')
>    list_filter = ('publication_date',)
>    date_hierarchy = 'publication_date'
>    ordering = ('-publication_date',)
>    fields = ('title', 'authors', 'publisher')
>
> Nor can I add fields back in to this example or I get a syntax error:
>
> class BookAdmin(admin.ModelAdmin):
>    list_display = ('title', 'publisher', 'publication_date')
>    list_filter = ('publication_date',)
>    date_hierarchy = 'publication_date'
>    ordering = ('-publication_date',)
>    filter_horizontal = ('authors',)
>    (would like to still define fields, but throws a syntax error)
>
> Same with this one:
>
> class BookAdmin(admin.ModelAdmin):
>    list_display = ('title', 'publisher', 'publication_date')
>    list_filter = ('publication_date',)
>    date_hierarchy = 'publication_date'
>    ordering = ('-publication_date',)
>    filter_horizontal = ('authors',)
>    raw_id_fields = ('publisher',)
>    (would like to still define fields, but throws a syntax error)
>
>
> Could someone please show me how to include "fields = ('title',
> 'authors', 'publisher')" without getting an error?
>
> Thanks,
> Gandeida
>
> --
> 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: How to build a social network

2011-04-20 Thread Kenny Meyer
On Wed, Apr 20, 2011 at 8:09 PM, Rodrigo Ruiz  wrote:
> Another thing I still haven't decided is between python with Django or ruby
> on rails.
> I know it's a Django group, so I know i must expect the good aspects on
> Django, but why should I use Django instead of ruby on rails?

I think you will mostly get subjective comments and not good answers
on your question. Best thing is to try them both, and go with the one
you feel most comfortable with.

I will vouch for Django, but again, that's totally subjective, and a
pretty bad question on the Django mailing list. :)
Do a google search like "Ruby vs Django site:stackoverflow.com" and
you can get some quick results.

> I don't know any, so I can't defend any, but one thing I had trouble with
> pytho with Django is information on what I want. With ruby I found a book on
> amazon "RailsSpace - Building a Social Networking Website with Ruby on
> Rails" which is specifically for what I want (build a social network), but I
> wasn't able to find anything on django.

There is Pinax, as previously mentioned.

-- 
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: Create a ContentType object on model save

2010-11-09 Thread Kenny Meyer
Kenny Meyer (knny.m...@gmail.com) wrote:
> Hello,
> 
> I have two models, 1) FlashCard and 2) Practice, and I have a generic relation
> in the FlashCard model pointing to the Practice model using the contenttypes
> framework.
> The Practice model tracks information like how many times something was
> practiced, and calculates an `easy factor'.
> Each time I save a FlashCard I want at the same time to create Practice
> object for the flashcard, automatically.
> 
> 
> class Practice(models.Model):
> content_type = models.ForeignKey(ContentType)
> object_id = models.PositiveIntegerField()
> item = generic.GenericForeignKey('content_type', 'object_id')
> 
> user = models.ForeignKey(User)
> 
> 
> class FlashCard(models.Model):
> """
> A basic Flashcard.
> 
> Has a front and a back view.
> """
> front = models.TextField(
> max_length = 255,
> verbose_name = "Front")
> back = models.TextField(
> max_length = 255,
> verbose_name = "Back")
> user = models.ForeignKey(User)
> practice = generic.GenericRelation(Practice)
> 
> 
> I read the contenttypes documentation, and as far as I understand to create a
> related Practice object for a flashcard instance I should do the following:
> 
> >>> user = User.objects.get(username="kenny")
> # Create a sample flashcard
> >>> flashcard = ("bla", "bla", user)
> # ...and create a Practice object for it
> >>> new_practice = Practice(item=flashcard)
> # then I try to save it, but that fails with a large backtrace
> >>> new_practice.save()
> [snip]
> 
> Here the actual backtrace: http://dpaste.com/hold/272617/

Ok, this is my error. Creating a flashcard was actually this:

   FlashCard(front="front side", back="back side", user)

then it worked, and so I could also create a Practice object.

> Well, but this is not the reason I opened this thread. Still I want to create
> Practice object for my FlashCard object.
> 
> I started a research on Google, but I really haven't found anything really
> helping me to do that.
> 
> Can you guys give me a helping hand on this with your expertise, please?
> 
> Additional information about my environment:
>   - Django 1.2.3
>   - PostgreSQL 8.4.5
> 
> Cheers,
> Kenny
> 
> -- 
> - Kenny Meyer 
> To understand recursion, we must first understand recursion.
> --

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Create a ContentType object on model save

2010-11-08 Thread Kenny Meyer
Hello,

I have two models, 1) FlashCard and 2) Practice, and I have a generic relation
in the FlashCard model pointing to the Practice model using the contenttypes
framework.
The Practice model tracks information like how many times something was
practiced, and calculates an `easy factor'.
Each time I save a FlashCard I want at the same time to create Practice
object for the flashcard, automatically.


class Practice(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
item = generic.GenericForeignKey('content_type', 'object_id')

user = models.ForeignKey(User)


class FlashCard(models.Model):
"""
A basic Flashcard.

Has a front and a back view.
"""
front = models.TextField(
max_length = 255,
verbose_name = "Front")
back = models.TextField(
max_length = 255,
verbose_name = "Back")
user = models.ForeignKey(User)
practice = generic.GenericRelation(Practice)


I read the contenttypes documentation, and as far as I understand to create a
related Practice object for a flashcard instance I should do the following:

>>> user = User.objects.get(username="kenny")
# Create a sample flashcard
>>> flashcard = ("bla", "bla", user)
# ...and create a Practice object for it
>>> new_practice = Practice(item=flashcard)
# then I try to save it, but that fails with a large backtrace
>>> new_practice.save()
[snip]

Here the actual backtrace: http://dpaste.com/hold/272617/


Well, but this is not the reason I opened this thread. Still I want to create
Practice object for my FlashCard object.

I started a research on Google, but I really haven't found anything really
helping me to do that.

Can you guys give me a helping hand on this with your expertise, please?

Additional information about my environment:
  - Django 1.2.3
  - PostgreSQL 8.4.5

Cheers,
Kenny

-- 
- Kenny Meyer 
To understand recursion, we must first understand recursion.
--


pgp3RUd4A9RGp.pgp
Description: PGP signature


Re: Pluggable Q&A app?

2010-05-15 Thread Kenny Meyer
bax...@gretschpages.com (mail.bax...@gmail.com) wrote:
> Can anyone give me any suggestions for a relatively simple, pluggable
> Q&A app? I'm looking for something sorta Stack-Overflow-ish, but I'm
> OK with handling voting, authentication, search, etc. separately.
> 
> What I've found so far (OSQA, Askbot, soclone) are far from pluggable.
> I don't want a whole other site, just an app.
> 
> Thanks.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
> 

Hi,

Have you already taken a look at CNPROG [1]? It looks very similar to Stack
Overflow, but beware that similar does *not* mean the *same*.

Actually, you could cherry-pick all the modules you'd like to have in your app
and mix them together.

[1] http://github.com/cnprog/CNPROG

-- 
  Regards,
  Kenny Meyer | http://kenny.alwaysdata.net

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Question!!!

2010-03-05 Thread Kenny Meyer
Russell Keith-Magee (freakboy3...@gmail.com) wrote:
> On Sat, Mar 6, 2010 at 6:55 AM, Kenny Meyer  wrote:
> > Wilmer A. Delpratt (wdelprat...@gmail.com) wrote:
> >> Hi everyone..i'm new in this group...my friends says this is one of
> >> the best groups...
> >> I'd like to know how i can use a ManyToManyField in a "list_display",
> >> i've read the documentation, but there says this is not possible
> >> (isn't supported),i wish to know if there is another way to solve
> >> this problem (i really need to do that)well that's all...thanks a
> >> lot
> >> PD: Sorry my bad englishi'm from Cuba (official language
> >> 'Spanish').
> >> Once again thank you all...please help me.see you
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups 
> >> "Django users" group.
> >> To post to this group, send email to django-us...@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.
> >>
> >
> > Hey Wilmer :)
> >
> > First of all I must criticize your attempt to ask a simple question.
> > Ever heard of using a meaningful subject [1]_, or how to ask *smart
> > questions* [2]_? Your style honestly sucks and is painful to read.=20
> > Period
> 
> Can you see the irony in coming in like a rabid bulldog when the
> original author was commenting on how he heard Django-users was such a
> nice community? Bravo. It takes special skills to miss the point so
> successfully.
> 
> There is absolutely no excuse for treating other human beings like
> crap. If you can't find a civil way to suggest that someone might want
> to rephrase their question, keep your mouth shut. We can live without
> that sort of attitude.
> 
> We can also live without the references to ESR. As I've noted many
> times on this group, his 'smart questions' rant is correct in spirit,
> but in no way shares the tone we are trying to maintain in this group.
> 
> Wilmer - on behalf of the group, I apologize for Kenny's response.
> Please don't consider his attitude to be representative of the group
> as a whole -- we're usually quite nice.
> 
> Yours,
> Russ Magee %-)
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
> 

Russ, 

I give in, my comment was very out of place.

I did not mean to offend neither to treat you (Wilmer) like crap and I'm
sorry for causing unnecessary trouble; I will try being solely focused on
the topic itself next time.

Best regards,
Kenny

-- 
  Kenny Meyer
  Software Geek | http://kenny.alwaysdata.net

  Shoot for the moon, even if you miss, you'll land amongst the stars..
- Les Brown

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Question!!!

2010-03-05 Thread Kenny Meyer
Wilmer A. Delpratt (wdelprat...@gmail.com) wrote:
> Hi everyone..i'm new in this group...my friends says this is one of
> the best groups...
> I'd like to know how i can use a ManyToManyField in a "list_display",
> i've read the documentation, but there says this is not possible
> (isn't supported),i wish to know if there is another way to solve
> this problem (i really need to do that)well that's all...thanks a
> lot
> PD: Sorry my bad englishi'm from Cuba (official language
> 'Spanish').
> Once again thank you all...please help me.see you
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
> 

Hey Wilmer :)

First of all I must criticize your attempt to ask a simple question.
Ever heard of using a meaningful subject [1]_, or how to ask *smart
questions* [2]_? Your style honestly sucks and is painful to read.=20
Period.

Back to topic:
Using a ManyToManyField in the Django's model class is not possible
AFAIK, but by writing a little Python function you can easily handly
this.

Take the following example:

class Book(models.Model):
...
authors =3D models.ManyToManyField(Author)
...

def get_authors(self):
return self.authors.all()

class Admin:
list_display =3D ('get_authors')

This is pretty self-explanatory and not tested, but should work.

> Hi everyone..i'm new in this group...my friends says this is one of
> the best groups...
They're certainly right your friends. ;)

Hope I could help,
Kenny

.. [1] http://www.hoax-slayer.com/email-subject-lines.html
.. [2] http://catb.org/~esr/faqs/smart-questions.html
-- 
  Kenny Meyer
  Software Geek | http://kenny.alwaysdata.net

  Shoot for the moon, even if you miss, you'll land amongst the stars..
- Les Brown

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Multiple views files

2010-03-04 Thread Kenny Meyer
Tom Evans (tevans...@googlemail.com) wrote:
> On Thu, Mar 4, 2010 at 10:39 AM, Kenny Meyer  wrote:
> > ...
> > I would probably have an app tree structure like this:
> >
> > test_app/
> > |-- __init__.py
> > |-- models.py
> > |-- tests.py
> > |-- view
> > |   |-- __init__.py
> > |   |-- blog_form_view.py
> > |   `-- blog_view.py
> > `-- views.py
> >
> > Where my views.py simply imports the views in the ``view`` folder.
> > I think it's essential that you keep the views.py, when you're not
> > running a personalized fork of Django and writing reusable apps. ;)
> >
> 
> I don't think this is necessary. I use this structure:
> (hope unicode line-drawing characters come through!)
> 
> app
> ├── __init__.py
> ├── models.py
> ├── tests.py
> ├── urls.py
> └── views
> ├── __init__.py
> ├── general.py
> └── users.py
> 
> I don't run a personal fork of django, and this app is perfectly
> reusable. In urls.py, I refer to the specific views like so:
> 
> urlpatterns = patterns('app.views.general',
>   url(),
>   )
> 
> I don't have to modify or alter any part of django to work like so.
> 
> 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-us...@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.
>

Tom, that makes absolute sense.

I'll take back, what I said earlier in this thread. [1]_

.. [1] I think it's essential that you keep the views.py, when you're not
running a personalized fork of Django and writing reusable apps. ;)

Very best regards,
Kenny

-- 
  Kenny Meyer
  Software Geek | http://kenny.alwaysdata.net

  Shoot for the moon, even if you miss, you'll land amongst the stars..
- Les Brown

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Multiple views files

2010-03-04 Thread Kenny Meyer
Wiiboy (jordon...@gmail.com) wrote:
> Hi guys,
> I'm thinking about making multiple views files.  I'm just wondering
> whether:
> a. There's any problems with that
> b. many people do it.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
> 

Hi wiiboy,

You mean having more than one module for your views?

> a. There's any problems with that
Since it's all Python I don't think there should be any problems with
that.

I would probably have an app tree structure like this:

test_app/
|-- __init__.py
|-- models.py
|-- tests.py
|-- view
|   |-- __init__.py
|   |-- blog_form_view.py
|   `-- blog_view.py
`-- views.py

Where my views.py simply imports the views in the ``view`` folder. 
I think it's essential that you keep the views.py, when you're not
running a personalized fork of Django and writing reusable apps. ;)

> b. many people do it.
AFAIK I don't know many Django developers who do that (if any). But why
not do it?

Large views modules can be quite readable and browseable if your
editor supports intelligent code folding.

Correct me if I got something wrong.

Cheers,
Kenny

-- 
  Kenny Meyer
  Software Geek | http://kenny.alwaysdata.net

  Shoot for the moon, even if you miss, you'll land amongst the stars..
- Les Brown

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: upgrade to released version 1.1.1 problems

2010-03-04 Thread Kenny Meyer
mendes.rich...@gmail.com (mendes...@gmail.com) wrote:
> Hello Django Users,
> 
> I just tried to upgrade my django version towards the last official
> release Django 1.1.1 and ran into some trouble after the install.
> When i do a runserver first it complained about an AttributeError:
> 'Settings' that didn't have certain attributes.
> 
> To solve this is added the following settings:
> LOCALE_PATHS = tuple()
> DEFAULT_INDEX_TABLESPACE = ''
> DEFAULT_TABLESPACE = ''
> 
> This solved this issue but i immediately ran into another one when i
> actually wanted to access the admin page.
> The message i get is:
> 
> File "/Library/Python/2.5/site-packages/django/core/handlers/base.py",
> line 42, in load_middleware
> raise exceptions.ImproperlyConfigured, 'Error importing middleware
> %s: "%s"' % (mw_module, e)
> ImproperlyConfigured: Error importing middleware
> django.contrib.sessions.middleware: "No module named simple"
> 
> Did anyone experience something similar and know how to solve this ?
> 
> best regards,
> 
> Richard
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
> 

Hi,

The traceback probably says it all:
> File "/Library/Python/2.5/site-packages/django/core/handlers/base.py",
> line 42, in load_middleware
> raise exceptions.ImproperlyConfigured, 'Error importing middleware
> %s: "%s"' % (mw_module, e)
> ImproperlyConfigured: Error importing middleware
> django.contrib.sessions.middleware: "No module named simple

You're trying to import a Middleware class which doesn't exist.
Compare your MIDDLEWARE_CLASSES with this working example:

MIDDLEWARE_CLASSES = ( 
'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)

Hope this helps.

-- 
  Kenny Meyer
  Software Geek | http://kenny.alwaysdata.net

  Shoot for the moon, even if you miss, you'll land amongst the stars..
- Les Brown

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Python app Installers

2010-01-27 Thread Kenny Meyer
zweb (traderash...@gmail.com) wrote:
> What is the best way to build installer for python/django based
> software product ?
> Like in Microsoft world you can have .exe and installshield?
> 
> I need to way which can guide user to setup database, run DB script,
> set up parameters and guide him through installation. Also want to
> give the option to do full install or apply only a patch/upgrade.

Have a look at python-setuptools.

May fit your needs.

-- 


signature.asc
Description: Digital signature


Re: Django 1.1 - Restart required for after creating and saving object for viewing it

2010-01-26 Thread Kenny Meyer
Martin J. Laubach (mjl+goo...@emsi.priv.at) wrote:
> > post_info_dict = {
> >     'queryset': Post.objects.all(),
> 
>   You probably don't want to evaluate your queryset here. Drop the .all
> () and you'll be good.
> 
> mjl
> 

Argh, the tiny details...

Thanks mjl! 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Django 1.1 - Restart required for after creating and saving object for viewing it

2010-01-26 Thread Kenny Meyer
Hello,

Problem:

 
I basically have a blog with a ``Post`` model, representing each post of
the blog. Now if I create an object, save it and want to view it I get
a 404 Error with Django saying "No post found for".
This like this until I restart the development server (actually when
deploying the same pattern occurs).

Here's the code:

# blog/models.py:

class Post(models.Model):

[snip]

def save(self, force_insert=True, force_update=False, *args, **kwargs):
[snip]
super(Post, self).save(force_insert, force_update, *args, **kwargs)
# For debugging:
print Post.objects.all()
# After creating a sample post it *actually* returns a list with
# the newly created and saved object. That's the strange thing.

# blog/views.py

[snip]

post_info_dict = {
'queryset': Post.objects.all(),
'date_field': 'date',
}

urlpatterns = patterns('',
(r'^(?P\d{4})/(?P\d{2})/(?P\d{2})/(?P[-\w]+)/$',
'django.views.generic.date_based.object_detail',
dict(post_info_dict, month_format = "%m"),),
[snip]

Troubleshooting:


Well I actually browsed the Post list (without restarting the
development server
I've also passed 'force_insert=True' with the save() function, but
doesn't affect the behaviour in any way appearently.
I could have debugged some SQL debugging, but I'm unfortunately not
very experienced with that.

I hoped that you could tell me what I'm doing wrong. I hope I'm being
detailed, if not, please request me for more info or ask.

-- 
Best regards,
Kenny


signature.asc
Description: Digital signature


Re: Feed not available - Syndication - Django 1.1.1

2010-01-22 Thread Kenny Meyer
Kenny Meyer (knny.m...@gmail.com) wrote:
> El 22/01/10 07:31, Kenny Meyer escribió:
> > I'm trying to generate some feeds for my blog with Django's high-level
> > Syndication Framework. 
> > My problem is, when browsing to the URL defined in the ``link``
> > attribute of the ``syndication.Feed`` model, there's no Feed
> > generated/displayed.
> >   
> The link attribute is just what will show in the feed markup as.. well..
> the feed's link, doesn't
> necessarily have to be the subscription url. You usually want to set it
> to the url for that content in your site. Look at Django's community
> aggregator feed:
> 
> 
> 
>   
> The Django community aggregator
> http://www.djangoproject.com/community/
> ...
> 
> While the link attribute is http://www.djangoproject.com/community/ ,
> the feed's url is actually http://www.djangoproject.com/rss/community/

I brought something out of order... Your example is perfectly logic and
understanding to me. I had a false concept of ``link``.
> > ---
> > PROBLEM
> > ---
> >
> > Now as mention earlier, when browsing to http://localhost:8000/blog/
> > there's no option for subscribing to the feed.
> > I've compared a lot of configurations and I cannot see the problem.
> >   
> 
> Well, isn't that something you'd define yourself? Or what do you mean by
> "option for subscribing to the feed"?

By that I mean, Django creating the link to the Syndication feed
automatically in the '' section of my template, which is wrong.
I now understand that.

So I've created a reference to the feed in my template and it's
working. :) Now I only have to check how to reverse lookup the feed to
not write static code.

Thanks for your help and time, Gonzalo.

Hablamos,
Kenny


signature.asc
Description: Digital signature


Feed not available - Syndication - Django 1.1.1

2010-01-22 Thread Kenny Meyer
Hi guys,

I'm trying to generate some feeds for my blog with Django's high-level
Syndication Framework. 
My problem is, when browsing to the URL defined in the ``link``
attribute of the ``syndication.Feed`` model, there's no Feed
generated/displayed.

If not clear what I'm trying to say, please read details on the bottom
of this message.

Here's my code:

apps/blog/feeds.py:

from django.contrib.syndication.feeds import Feed
from blog.models import Post

class LatestPosts(Feed):
"""Returns a Feed object with the 5 latest blog posts"""
link = "/blog/"
title = "Latest Blog Posts"
description = "Latest blog posts from the Paraguayan Geek."

def items(self):
return Post.objects.order_by('-date')[:5]

apps/blog/urls.py: [shortened]

feeds = {
'latest': LatestPosts,
}

urlpatterns = patterns(
'',
(r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed',
   {'feed_dict': feeds},)
)

---
OBSERVATION
---

I access the feed with http://localhost:8000/blog/feeds/latest/ and it
works just fine. Displays the latest articles with title and
description.

---
PROBLEM
---

Now as mention earlier, when browsing to http://localhost:8000/blog/
there's no option for subscribing to the feed.
I've compared a lot of configurations and I cannot see the problem.

Please help me out on this one, please.
-- 


signature.asc
Description: Digital signature


Re: how relate webpage with databse in my harddisk?

2010-01-06 Thread Kenny Meyer
> How other can access pages i generated with django?
You mean how others can access pages which Django generated *for you*.
If you're connected with computers in a home network they can see your
work with a webbrowser, knowing the IP address of the Pc which is
serving the Django "pages". Usually this is :8000 if
you're using Django's development server.
If you want to deploy it on a web server, read this:
http://docs.djangoproject.com/en/dev/howto/deployment/
> How others could be able to fill forms and get data from my hard disk
> through generated html interface?
Through a webbrowser.
> I would like to connect to generated html pages through internet [..]
Redirect traffic from your router which is incoming on port 80 to your
local machine to any port on which your webserver is running. Now that's
a very brief how-to. Google is your friend.


signature.asc
Description: Digital signature


Re: Django 1.1 - comments - ‘render_comment_ form’ returns TemplateSyntaxError

2009-12-10 Thread Kenny Meyer
On Wed, 9 Dec 2009 21:58:39 -0500
Karen Tracey  wrote:

> On Wed, Dec 9, 2009 at 8:24 PM, Kenny Meyer 
> wrote:
> 
> >
> > /urls.py[shortened]:
> > urlpatterns = patterns('',
> >(r'', include('posts.urls')),
> >(r'^comments/$', include('django.contrib.comments.urls')),
> > )
> >
> >
> Remove the $ from the end of the pattern for the comment urls.
> 
> Karen

Thanks, Karen. It's functioning now perfectly.. I couldn't believe it
was only a typo!

Well, I'll know in the future from now on.

Regards,
Kenny


signature.asc
Description: PGP signature


Django 1.1 - comments - ‘render_comment_for m’ returns TemplateSyntaxError

2009-12-09 Thread Kenny Meyer
Hello,

I want to simply render a built-in comment form in a template, using
Django's builtin commenting module, but this returns a
TemplateSyntaxError Exception.

I need help debugging this error, please, because after googling and
using the Django API reference, I'm still not getting any farther.

Info [http://pastebin.com/m189a1af3]: 

This is the template '_post.html'[shortened]:


{{ object.title }}
{{ object.pub_date|timesince }} ago

{{ object.body }}
{% load comments %}
{% get_comment_count for object as comment_count %}
{{ comment_count }}

{% render_comment_form for object %}


This is the Exception output, when rendering:

Caught an exception while rendering: Reverse for
'django.contrib.comments.views.comments.post_comment' with arguments
'()' and keyword arguments '{}' not found.1 {% load comments i18n %}

  {% if next %}{% endif %} {% for field in form %}
{% if field.is_hidden %}
  {{ field }}
{% else %}
  {% if field.errors %}{{ field.errors }}{% endif %}
   {{ field.label_tag }} {{ field }}

/posts/urls.py[shortened]:
queryset = {'queryset': Post.objects.all(),
'extra_context' : {"tags" : get_tags}
   }   
urlpatterns = patterns('django.views.generic.list_detail',
url('^$',   'object_list',  queryset,
name='posts'),
url('^blog/(?P\d+)/$',   'object_detail',queryset,
name='post'),
)

/urls.py[shortened]:
urlpatterns = patterns('',
(r'', include('posts.urls')),
(r'^comments/$', include('django.contrib.comments.urls')),
)



  .'  `.knny [d0t] myer [at] gmail [d0t] com 
  |a_a  |   http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2
  \<_)__/    
  /(   )\   Everything should be made as simple as possible, but not 
 |\`> < /\simpler.
 \_|=='|_/-- Albert Einstein 


signature.asc
Description: PGP signature


Re: Browsing Django modules from interactive python shell

2009-12-02 Thread Kenny Meyer
On Wed, 2 Dec 2009 11:36:48 -0500
Bill Freeman  wrote:

> import a
> 
> does not automatically import modules and sub packages of package a.
> It takes special action in a's __init__.py to make this happen as it
> does for os.path when
> you import os.
> 
> I assume that you're doing this directly in python, since in the
> manage.py shell other stuff has already caused django.core to be
> imported, so it's available. (And Frank was probably using the
> manage.py shell, thus finding that he didn't have to separately
> import django.core .)
> 
> On Wed, Dec 2, 2009 at 11:14 AM, Kenny Meyer 
> wrote:
> > Hi guys,
> >
> > I have some strange behaviour in my interactive python shell, when
> > trying to browse Django modules...
> >
> > Example:
> >
> >>>> import django
> >>>> dir(django.core)
> > AttributeError: 'module' object has no attribute 'core'
> >
> >>>> import django.core
> >>>> dir(django.core)
> > ['__builtins__', '__doc__', '__file__', '__name__', '__package__',
> > '__path__']
> >
> > Can anyone, please, explain me this strange (to me) behaviour?
> >
> > Regards,
> > Kenny
> >
> > 
> >  .'  `.    knny [d0t] myer [at] gmail [d0t] com [42!]
> >  |a_a  |   http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2
> >  \<_)__/   
> >  /(   )\   Everything should be made as simple as possible, but not
> >  |\`> < /\                        simpler.
> >  \_|=='|_/                                        -- Albert Einstein
> >
> 
> --
> 
> You received this message because you are subscribed to the Google
> Groups "Django users" group. To post to this group, send email to
> django-us...@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.
> 
> 

Hello Bill,

I haven't seen your reply at first... Slow receiving from mail-client.

I've done as you said, and yes, I successfully browse all modules when
running `manage.py shell`, but because I was using directly using
Python, I received just the limited output.

Thanks for the explanation.

Regards,
Kenny


signature.asc
Description: PGP signature


Re: Browsing Django modules from interactive python shell

2009-12-02 Thread Kenny Meyer
On Wed, 2 Dec 2009 11:19:41 -0500
Frank DiRocco  wrote:

> How about trying to look at whats available for django... mine says
> this
> 
>  >>> import django
>  >>> dir(django)
> ['VERSION', '__builtins__', '__doc__', '__file__', '__name__',  
> '__package__', '__path__', 'conf', 'contrib', 'core', 'db',  
> 'dispatch', 'forms', 'get_version', 'http', 'middleware',
> 'shortcuts', 'template', 'utils', 'views']
>  >>> dir(django.core)
> ['__builtins__', '__doc__', '__file__', '__name__', '__package__',  
> '__path__', 'cache', 'exceptions', 'files', 'management', 'signals',  
> 'urlresolvers']
> 
> 
> On Dec 2, 2009, at 11:14 AM, Kenny Meyer wrote:
> 
> > Hi guys,
> >
> > I have some strange behaviour in my interactive python shell, when
> > trying to browse Django modules...
> >
> > Example:
> >
> >>>> import django
> >>>> dir(django.core)
> > AttributeError: 'module' object has no attribute 'core'
> >
> >>>> import django.core
> >>>> dir(django.core)
> > ['__builtins__', '__doc__', '__file__', '__name__', '__package__',
> > '__path__']
> >
> > Can anyone, please, explain me this strange (to me) behaviour?
> >
> > Regards,
> > Kenny
> >
> > 
> >  .'  `.knny [d0t] myer [at] gmail [d0t] com [42!]
> >  |a_a  |   http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2
> >  \<_)__/   
> >  /(   )\   Everything should be made as simple as possible, but not
> > |\`> < /\simpler.
> > \_|=='|_/-- Albert Einstein
> 
> --
> 
> You received this message because you are subscribed to the Google
> Groups "Django users" group. To post to this group, send email to
> django-us...@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.
> 
> 

Hi Frank,

Well that's strange... I don't get similar output, but see it yourself:

>>> import django
>>> dir(django)
['VERSION', '__builtins__', '__doc__', '__file__', '__name__',
'__package__', '__path__', 'get_version']

I'm running Ubuntu 9.10 and installed django with `aptitude` named
`python-django`.

Regards,
Kenny


signature.asc
Description: PGP signature


Browsing Django modules from interactive python shell

2009-12-02 Thread Kenny Meyer
Hi guys,

I have some strange behaviour in my interactive python shell, when
trying to browse Django modules...

Example:

>>> import django
>>> dir(django.core)
AttributeError: 'module' object has no attribute 'core'

>>> import django.core
>>> dir(django.core)
['__builtins__', '__doc__', '__file__', '__name__', '__package__',
'__path__']

Can anyone, please, explain me this strange (to me) behaviour?

Regards,
Kenny


  .'  `.knny [d0t] myer [at] gmail [d0t] com [42!]
  |a_a  |   http://kenny.paraguayinfos.de | gpg key ID: 0x00F56BA1B2
  \<_)__/    
  /(   )\   Everything should be made as simple as possible, but not 
 |\`> < /\simpler.
 \_|=='|_/-- Albert Einstein 


signature.asc
Description: PGP signature