Re: Blog Listing on Home Page

2011-02-22 Thread delegbede
Got the book. Thanks a million Karen. 
Sent from my BlackBerry wireless device from MTN

-Original Message-
From: Karen McNeil 
Sender: django-users@googlegroups.com
Date: Tue, 22 Feb 2011 15:56:20 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Re: Blog Listing on Home Page

This is definitely doable.  And easy -- you can use django's generic
views for it.

I recommend you pick up / download "Practical Django Projects," by
James Bennett.  He'll walk you through every step for creating a blog,
using generic views, etc.

~Karen McNeil


On Feb 21, 4:33 pm, delegb...@dudupay.com wrote:
> Hello People,
>
> I have a blog I'm currently designing and I have a little challenge.
>
> I can from the view get a template to render all the blogs in the database by 
> fetching
> articles = Article.objects.all()
> from the view and then loop over it in my template like so:
> {% for article in articles %}
> article.author
> article.date
> article.content
> {% endfor %}
> This renders all the articles in my blog.
> I however want it to show an article per page.
> How can I achieve that.
> Alternatively, I am thinking I could do a filter of articles on my home page 
> and the do a drill down from years, to months and then days. With title of 
> each article rendered such that a visitor can click on a title and then 
> directed to a page rendering the particular article.
> Is it doable? If yes, kindly give me a lead. And if no, kindly suggest a way 
> out.
> Thanks.
> Sent from my BlackBerry wireless device from MTN

-- 
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: Question(s) Concerning Securing Pages From Bots?

2011-02-22 Thread Mike Ramirez
On Tuesday, February 22, 2011 10:03:41 pm Kenneth Gonsalves wrote:
> On Tue, 2011-02-22 at 18:23 +, Cal Leeming [Simplicity Media Ltd]
> 
> wrote:
> >  > +captcha>Not
> > busting your balls but, please at least make an effort to look on
> > Google
> > before posting questions to the list.
> 
> this is even better:
> 
> http://duckduckgo.com/?q=django+captcha

recaptcha might be a better approach.  Same googling, just add 're' to the 
captcha part. If you an't find a project/app with one, I can whip something up 
in a couple days.

Mike
-- 
The POP server is out of Coke

-- 
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: Question(s) Concerning Securing Pages From Bots?

2011-02-22 Thread Kenneth Gonsalves
On Tue, 2011-02-22 at 18:23 +, Cal Leeming [Simplicity Media Ltd]
wrote:
>  +captcha>Not
> busting your balls but, please at least make an effort to look on
> Google
> before posting questions to the list. 

this is even better:

http://duckduckgo.com/?q=django+captcha
-- 
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: urls.py and views.generic issue

2011-02-22 Thread Chris Matthews
Hi Antti,



1) Your day match is for \w{1,2} which will match one or 2 digits but also word 
characters because \w is same as [a-zA-Z0-9_] (see re documentation).



(r'(?P\d{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[-w]+)/$'

Should be

(r'(?P\d{4})/(?P[a-z]{3})/(?P\d{1,2})/(?P[-w]+)/$'



2) The slash before the [ is wrong. See http://docs.python.org/library/re.html 
[] is used to match a set/range of characters.

 (?P\[a-z]{3})"



 
(r'^(?P\d{4})/(?P\[a-z]{3})/(?P\w{1,2})/(?P\[-w]+)/$',

 (r'^(?P\d{4})/(?P\[a-z]{3})/(?P\w{1,2})/$',

 (r'^(?P\d{4})/(?P\[a-z]{3})/$',



3) The list.html is shown because it matches:

(r'^blog/', include('anttipetaisto.blog.urls')),

and then

(r'^$','archive_index', dict(info_dict, template_name='blog/list.html')),





What URL do you enter when you get the error?



Regards

Chris



-Original Message-

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Antti

Sent: 23 February 2011 06:56

To: Django users

Subject: Re: urls.py and views.generic issue



Thanks jnns for the response.  I tried adding the backslash but it

still doesn't match. Would I need to put a different character after

the other entries in the expression? What I mean would there be a

different character used in "(?P\[a-z]{3})" ?  Also one more

note if I type in http://127.0.0.1:8000/blog/ then the page loads

using the list.html template as it should.   I have included the main

urls.py as well as the blog urls.py



-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Antti
Sent: 23 February 2011 06:48
To: Django users
Subject: Re: urls.py and views.generic issue



Hello Chris, thanks for the response. I don't know where that space is

coming from.  When I type in http://127.0.0.1:8000/blog/ a page loads

using the list.html template as it should. Would that mean that the

space might be fine because the main urls.py is calling the blog

urls.py?



I have a main urls.py and then I have a blog urls.py. The files are as

below and the space is added somewhere along the lines.



Main urls.py



from django.conf.urls.defaults import *



# Uncomment the next two lines to enable the admin:

from django.contrib import admin



admin.autodiscover()



urlpatterns = patterns('',

# Example:

# (r'^anttipetaisto/', include('anttipetaisto.foo.urls')),



# Uncomment the admin/doc line below to enable admin

documentation:

 (r'^admin/doc/', include('django.contrib.admindocs.urls')),



# Uncomment the next line to enable the admin:

 (r'^admin/', include(admin.site.urls)),

 (r'^tags/(?P[a-zA-Z0-9_.-]+)/$',

'anttipetaisto.tag_views.tag_detail'),

 (r'^blog/', include('anttipetaisto.blog.urls')),

 (r'^static_files/(?P.*)$', 'django.views.static.serve',

{'document_root': '/home/antti/django/anttipetaisto/static_files'}),





Blog urls.py



from django.conf.urls.defaults import *

from anttipetaisto.blog.models import Entry

from tagging.views import tagged_object_list



info_dict = {

'queryset': Entry.objects.filter(status=1),

'date_field': 'pub_date',

}



urlpatterns = patterns('django.views.generic.date_based',

 (r'(?P\d{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[-

w]+)/$', 'object_detail', dict(info_dict, slug_field='slug',

template_name='blog/detail.html')),

 (r'^(?P\d{4})/(?P\[a-z]{3})/(?P\w{1,2})/(?

P\[-w]+)/$', 'object_detail', dict(info_dict,

template_name='blog/list.html')),

 (r'^(?P\d{4})/(?P\[a-z]{3})/(?P\w{1,2})/

$','archive_day',dict(info_dict,template_name='blog/list.html')),

 (r'^(?P\d{4})/(?P\[a-z]{3})/$','archive_month',

dict(info_dict, template_name='blog/list.html')),

 (r'^(?P\d{4})/$','archive_year', dict(info_dict,

template_name='blog/list.html')),

 (r'^$','archive_index', dict(info_dict, template_name='blog/

list.html')),

)



On Feb 20, 10:47 pm, Chris Matthews  wrote:

> It also seems that the space preceding the caret ^ should not be there

>

> So

>

> ^blog/ ^(?P\d{4})/$

>

> Should be

>

> ^blog/^(?P\d{4})/$

>

>

>

>

>

>

>

> -Original Message-

> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
> Behalf Of jnns

> Sent: 20 February 2011 03:07

> To: Django users

> Subject: Re: urls.py and views.generic issue

>

> Hi Antti,

>

> the url patterns in the tutorial are not correct. The regular

>

> expressions are not using character classes but merely plain

>

> characters.

>

> ^blog/ ^(?Pd{4})/$

>

> should be

>

> ^blog/ ^(?P\d{4})/$

>

> Mind the backslash in \d{4}. This way we're matching for a sequence of

>

> four digits and not for a sequence of four "d"s.

>

> Regards,

>

> jnns

>

> On Feb 20, 12:57 am, Antti  wrote:

>

> > The problem:

>

> > I can't seem to get most of my urls that I type in my browser to math

>

> > a url in my urls.py file.  I am currently doing Web Monkey's Blog

>

> > Tutorial (http://ww

Re: Question(s) Concerning Securing Pages From Bots?

2011-02-22 Thread Kenneth Gonsalves
On Tue, 2011-02-22 at 10:09 -0800, hank23 wrote:
> On some web pages the user is prompted to type in a series of randomly
> generated characters which appear on the screen, in order to limit
> access of those pages to real users instead of allowing bots to also
> access them. Now my question is is there a plug-in, sample code, or
> outright django documentation for doing something like that in a
> django/python web application? If so can someone point me to it?
> Thanks. 

it is called captcha, and there are a few for django. Try a search on
django+captcha
-- 
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: ViewDoesNotExist Error

2011-02-22 Thread ravi krishna
Hi all,

I got it solved.

def employeeProfile(request): *emp_profile* = EmployeeDetails.objects.all()
return
render_to_response('employeeProfile.html',{'emp_profile':emp_profile})



Thanks & Regards,

Ravi Krishna
My profiles: [image:
Facebook] [image:
LinkedIn]  [image:
Twitter] 




On Wed, Feb 23, 2011 at 10:29 AM, Mike Ramirez  wrote:

>  On Tuesday, February 22, 2011 08:24:43 pm ravi krishna wrote:
>
> > from task.employeeDetails import emp_profile
>
> I did see* not where emp_profile comes from.
>
>  Mike
>
> (sorry).
>
> --
>
> We are sorry. We cannot complete your call as dialed. Please check
>
> the number and dial again or ask your operator for assistance.
>
> This is a recording.
>
>  --
> 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: urls.py and views.generic issue

2011-02-22 Thread Antti
Hello Chris, thanks for the response. I don't know where that space is
coming from.  When I type in http://127.0.0.1:8000/blog/ a page loads
using the list.html template as it should. Would that mean that the
space might be fine because the main urls.py is calling the blog
urls.py?

I have a main urls.py and then I have a blog urls.py. The files are as
below and the space is added somewhere along the lines.

Main urls.py

from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
# Example:
# (r'^anttipetaisto/', include('anttipetaisto.foo.urls')),

# Uncomment the admin/doc line below to enable admin
documentation:
 (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
 (r'^admin/', include(admin.site.urls)),
 (r'^tags/(?P[a-zA-Z0-9_.-]+)/$',
'anttipetaisto.tag_views.tag_detail'),
 (r'^blog/', include('anttipetaisto.blog.urls')),
 (r'^static_files/(?P.*)$', 'django.views.static.serve',
{'document_root': '/home/antti/django/anttipetaisto/static_files'}),


Blog urls.py

from django.conf.urls.defaults import *
from anttipetaisto.blog.models import Entry
from tagging.views import tagged_object_list

info_dict = {
'queryset': Entry.objects.filter(status=1),
'date_field': 'pub_date',
}

urlpatterns = patterns('django.views.generic.date_based',
 (r'(?P\d{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[-
w]+)/$', 'object_detail', dict(info_dict, slug_field='slug',
template_name='blog/detail.html')),
 (r'^(?P\d{4})/(?P\[a-z]{3})/(?P\w{1,2})/(?
P\[-w]+)/$', 'object_detail', dict(info_dict,
template_name='blog/list.html')),
 (r'^(?P\d{4})/(?P\[a-z]{3})/(?P\w{1,2})/
$','archive_day',dict(info_dict,template_name='blog/list.html')),
 (r'^(?P\d{4})/(?P\[a-z]{3})/$','archive_month',
dict(info_dict, template_name='blog/list.html')),
 (r'^(?P\d{4})/$','archive_year', dict(info_dict,
template_name='blog/list.html')),
 (r'^$','archive_index', dict(info_dict, template_name='blog/
list.html')),
)

On Feb 20, 10:47 pm, Chris Matthews  wrote:
> It also seems that the space preceding the caret ^ should not be there
>
> So
>
> ^blog/ ^(?P\d{4})/$
>
> Should be
>
> ^blog/^(?P\d{4})/$
>
>
>
>
>
>
>
> -Original Message-
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
> Behalf Of jnns
> Sent: 20 February 2011 03:07
> To: Django users
> Subject: Re: urls.py and views.generic issue
>
> Hi Antti,
>
> the url patterns in the tutorial are not correct. The regular
>
> expressions are not using character classes but merely plain
>
> characters.
>
> ^blog/ ^(?Pd{4})/$
>
> should be
>
> ^blog/ ^(?P\d{4})/$
>
> Mind the backslash in \d{4}. This way we're matching for a sequence of
>
> four digits and not for a sequence of four "d"s.
>
> Regards,
>
> jnns
>
> On Feb 20, 12:57 am, Antti  wrote:
>
> > The problem:
>
> > I can't seem to get most of my urls that I type in my browser to math
>
> > a url in my urls.py file.  I am currently doing Web Monkey's Blog
>
> > Tutorial (http://www.webmonkey.com/2010/02/Get_Started_With_Django/)
>
> > To date everything has worked but when I try to use the urls from the
>
> > blog urls.py I get the following error:
>
> > Using the URLconf defined in anttipetaisto.urls, Django tried these
>
> > URL patterns, in this order:
>
> > ^admin/doc/
>
> > ^admin/
>
> > ^blog/ (?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[-w]
>
> > +)/$
>
> > ^blog/ ^(?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[-
>
> > w]+)/$
>
> > ^blog/ ^(?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/$
>
> > ^blog/ ^(?Pd{4})/(?P[a-z]{3})/$
>
> > ^blog/ ^(?Pd{4})/$
>
> > ^blog/ ^$
>
> > ^tags/(?P[a-zA-Z0-9_.-]+)/$
>
> > ^static_files/(?P.*)$
>
> > The current URL, blog/2011/jan/20/things-learned-finland/, didn't
>
> > match any of these.
>
> > What I don't understand why this is saying that isn't a url match.
>
> > Shouldn't it match the third one down?
>
> > Thanks
>
> > Antti
>
> --
>
> 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 
> athttp://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: ViewDoesNotExist Error

2011-02-22 Thread Mike Ramirez
On Tuesday, February 22, 2011 08:24:43 pm ravi krishna wrote:
> from task.employeeDetails import emp_profile

I did see* not where emp_profile comes from.  


Mike

(sorry).
-- 
We are sorry.  We cannot complete your call as dialed.  Please check
the number and dial again or ask your operator for assistance.

This is a recording.

-- 
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: urls.py and views.generic issue

2011-02-22 Thread Antti
Thanks jnns for the response.  I tried adding the backslash but it
still doesn't match. Would I need to put a different character after
the other entries in the expression? What I mean would there be a
different character used in "(?P\[a-z]{3})" ?  Also one more
note if I type in http://127.0.0.1:8000/blog/ then the page loads
using the list.html template as it should.   I have included the main
urls.py as well as the blog urls.py

Thanks for responding!

Antti

main urls.py

from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
# Example:
# (r'^anttipetaisto/', include('anttipetaisto.foo.urls')),

# Uncomment the admin/doc line below to enable admin
documentation:
 (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
 (r'^admin/', include(admin.site.urls)),
 (r'^tags/(?P[a-zA-Z0-9_.-]+)/$',
'anttipetaisto.tag_views.tag_detail'),
 (r'^blog/', include('anttipetaisto.blog.urls')),
 (r'^static_files/(?P.*)$', 'django.views.static.serve',
{'document_root': '/home/antti/django/anttipetaisto/static_files'}),
)


blog urls.py

from django.conf.urls.defaults import *
from anttipetaisto.blog.models import Entry
from tagging.views import tagged_object_list

info_dict = {
'queryset': Entry.objects.filter(status=1),
'date_field': 'pub_date',
}



urlpatterns = patterns('django.views.generic.date_based',
 (r'(?P\d{4})/(?P\[a-z]{3})/(?P\w{1,2})/(?P
\[-w]+)/$', 'object_detail', dict(info_dict, slug_field='slug',
template_name='blog/detail.html')),
 (r'^(?P\d{4})/(?P\[a-z]{3})/(?P\w{1,2})/(?
P\[-w]+)/$', 'object_detail', dict(info_dict,
template_name='blog/list.html')),
 (r'^(?P\d{4})/(?P\[a-z]{3})/(?P\w{1,2})/
$','archive_day',dict(info_dict,template_name='blog/list.html')),
 (r'^(?P\d{4})/(?P\[a-z]{3})/$','archive_month',
dict(info_dict, template_name='blog/list.html')),
 (r'^(?P\d{4})/$','archive_year', dict(info_dict,
template_name='blog/list.html')),
 (r'^$','archive_index', dict(info_dict, template_name='blog/
list.html')),
)


On Feb 19, 6:06 pm, jnns  wrote:
> Hi Antti,
>
> the url patterns in the tutorial are not correct. The regular
> expressions are not using character classes but merely plain
> characters.
>
> ^blog/ ^(?Pd{4})/$
> should be
> ^blog/ ^(?P\d{4})/$
>
> Mind the backslash in \d{4}. This way we're matching for a sequence of
> four digits and not for a sequence of four "d"s.
>
> Regards,
> jnns
>
> On Feb 20, 12:57 am, Antti  wrote:
>
>
>
>
>
>
>
> > The problem:
>
> > I can't seem to get most of my urls that I type in my browser to math
> > a url in my urls.py file.  I am currently doing Web Monkey's Blog
> > Tutorial (http://www.webmonkey.com/2010/02/Get_Started_With_Django/)
> > To date everything has worked but when I try to use the urls from the
> > blog urls.py I get the following error:
>
> > Using the URLconf defined in anttipetaisto.urls, Django tried these
> > URL patterns, in this order:
>
> > ^admin/doc/
> > ^admin/
> > ^blog/ (?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[-w]
> > +)/$
> > ^blog/ ^(?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/(?P[-
> > w]+)/$
> > ^blog/ ^(?Pd{4})/(?P[a-z]{3})/(?Pw{1,2})/$
> > ^blog/ ^(?Pd{4})/(?P[a-z]{3})/$
> > ^blog/ ^(?Pd{4})/$
> > ^blog/ ^$
> > ^tags/(?P[a-zA-Z0-9_.-]+)/$
> > ^static_files/(?P.*)$
>
> > The current URL, blog/2011/jan/20/things-learned-finland/, didn't
> > match any of these.
>
> > What I don't understand why this is saying that isn't a url match.
> > Shouldn't it match the third one down?
>
> > Thanks
>
> > Antti

-- 
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: ViewDoesNotExist Error

2011-02-22 Thread Mike Ramirez
On Tuesday, February 22, 2011 08:24:43 pm ravi krishna wrote:
> from task.employeeDetails import emp_profile

I did not where emp_profile comes from.  

Mike
-- 
We are sorry.  We cannot complete your call as dialed.  Please check
the number and dial again or ask your operator for assistance.

This is a recording.

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



ViewDoesNotExist Error

2011-02-22 Thread ravi krishna
Hi,
 i am trying to do a simple Django application where employee list is read
from database and displayed. for that i defined the models and entered the
values to database through Django admin. But while trying to display data
from database i am stuck with an error, "ViewDoesNotExist at
/employeeProfile/ : Could not import task.employeeDetails.views. Error was:
cannot import name emp_profile ".I am relatively new to django,so please
help me to solve this. This is the code

*VIEWS.PY *
from django.shortcuts import render_to_response
 from django.contrib.auth.models import*
from task.employeeDetails.models import *
 from django.conf import settings
from django.http import HttpResponse
from task.employeeDetails import emp_profile

def employeeList(request): tableList = EmployeeDetails.objects.all() return
render_to_response('employeeList.html', {'emp_list': tableList})

def employeeProfile(request): profile = EmployeeDetails.objects.all() return
render_to_response('employeeProfile.html',{'emp_profile':emp_profile})

*URLS.PY*

(r'^employeeProfile/$','task.employeeDetails.views.employeeProfile'),

*TEMPLATE *

{%for emp in emp_profile%} {{ emp.userName }} {{ emp.designation }} {{
emp.employeeID }} {%endfor%}

*MODELS.PY*

from django.db import models
class EmployeeDetails(models.Model):
userName = models.CharField(max_length=200)
designation = models.CharField(max_length=200)
employeeID = models.IntegerField()
contactNumber = models.IntegerField()
project = models.CharField(max_length=200)
dateOfJoin=models.DateField()


Thanks & Regards,

Ravi Krishna
My profiles: [image:
Facebook] [image:
LinkedIn]  [image:
Twitter] 


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

2011-02-22 Thread Dana Woodman
Please don't click on that link, it appears someone got into my account...

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



[no subject]

2011-02-22 Thread Dana Woodman
 http://europucier.com/cool01.11.php?ID=528

-- 

Cheers,
Dana W.

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



Cross Site Request Forgery (csrf) via POST / JQuery

2011-02-22 Thread gorans
Hi

I'm using Django's CSRFViewMiddleware and am making a POST request in
a page (using JQuery) in the form of:

$.post('{% url posted_to_wall %}', {
network: 'FBK',
action_type: 'feed',
effect: 1
});

In order to satisfy the csrf_token check, I have implemented the
instructions from the Django docs: 
http://docs.djangoproject.com/en/dev/ref/contrib/csrf/
(with some tweaks to only run the csrf on POST and not GET)

$('html').ajaxSend(function(event, xhr, settings) {
xhr.setRequestHeader("x-testing1", 'testme1');
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
// optimise this!
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we
want?
if (cookie.substring(0, name.length + 1) == (name +
'=')) {
cookieValue =
decodeURIComponent(cookie.substring(name.length + 1));
//console.log('cookie is ' + cookieValue);
break;
}
}
}
return cookieValue;
}

//console.log(/^http:.*/.test(settings.url));

if (settings.type == 'POST') {
if (!(/^http:.*/.test(settings.url) || /
^https:.*/.test(settings.url))) {
// Only send the token to relative URLs i.e. locally.
// console.log('we\'re local ajax');
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
}
});

However, the X-CSRFToken request is not being set by the command
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));

I have tried on both Chrome 11.0.672.2 dev and Firefox 4.0b11

I have worked around the issue by adding  csrfmiddlewaretoken: $
('input[name|="csrfmiddlewaretoken"]').attr('value')  to my POST data,
but would prefer to have it all done with the .ajaxSend method
presented in the Django Docs.

Does anyone have any suggestions as to why the xhr.setRequestHeader()
doesn't work?

Thanks is advance

Goran!

-- 
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: Blog Listing on Home Page

2011-02-22 Thread delegbede
Thanks Karen. I'd get the book and work through it. 
Regards. 

Sent from my BlackBerry wireless device from MTN

-Original Message-
From: Karen McNeil 
Sender: django-users@googlegroups.com
Date: Tue, 22 Feb 2011 15:56:20 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Re: Blog Listing on Home Page

This is definitely doable.  And easy -- you can use django's generic
views for it.

I recommend you pick up / download "Practical Django Projects," by
James Bennett.  He'll walk you through every step for creating a blog,
using generic views, etc.

~Karen McNeil


On Feb 21, 4:33 pm, delegb...@dudupay.com wrote:
> Hello People,
>
> I have a blog I'm currently designing and I have a little challenge.
>
> I can from the view get a template to render all the blogs in the database by 
> fetching
> articles = Article.objects.all()
> from the view and then loop over it in my template like so:
> {% for article in articles %}
> article.author
> article.date
> article.content
> {% endfor %}
> This renders all the articles in my blog.
> I however want it to show an article per page.
> How can I achieve that.
> Alternatively, I am thinking I could do a filter of articles on my home page 
> and the do a drill down from years, to months and then days. With title of 
> each article rendered such that a visitor can click on a title and then 
> directed to a page rendering the particular article.
> Is it doable? If yes, kindly give me a lead. And if no, kindly suggest a way 
> out.
> Thanks.
> Sent from my BlackBerry wireless device from MTN

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



innodb ibdata1 file grows irreversibly from testing

2011-02-22 Thread Cody Django
from what I understand, the ibdata1 file doesn't recover space from
dropped tables.  Since django testing creates a test database and then
drops it, repeatedly, does this contribute to the ibdata1 file size?

Thanks

Cody

-- 
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: Blog Listing on Home Page

2011-02-22 Thread Karen McNeil
This is definitely doable.  And easy -- you can use django's generic
views for it.

I recommend you pick up / download "Practical Django Projects," by
James Bennett.  He'll walk you through every step for creating a blog,
using generic views, etc.

~Karen McNeil


On Feb 21, 4:33 pm, delegb...@dudupay.com wrote:
> Hello People,
>
> I have a blog I'm currently designing and I have a little challenge.
>
> I can from the view get a template to render all the blogs in the database by 
> fetching
> articles = Article.objects.all()
> from the view and then loop over it in my template like so:
> {% for article in articles %}
> article.author
> article.date
> article.content
> {% endfor %}
> This renders all the articles in my blog.
> I however want it to show an article per page.
> How can I achieve that.
> Alternatively, I am thinking I could do a filter of articles on my home page 
> and the do a drill down from years, to months and then days. With title of 
> each article rendered such that a visitor can click on a title and then 
> directed to a page rendering the particular article.
> Is it doable? If yes, kindly give me a lead. And if no, kindly suggest a way 
> out.
> Thanks.
> Sent from my BlackBerry wireless device from MTN

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

2011-02-22 Thread Mario8k
The same occur when use "exclude = (att1,att2..)" because the fields
are mandatory.

I only need to update a model (not add, nor delete) whith a subset of
editable fields, if i'm not superuser.

On 22 feb, 19:10, Mario8k  wrote:
> Hi,
>
> Trying to make a custom model admin form for a staff user (not a
> superuser), I had to override ModelAdmin.get_readonly_fields() and
> ModelAdmin.get_fieldsets(). The problem arrives when i try to change
> the data of a model record, because the field is mandatory
> (blank=False, as default). When i submit the form, i got an error on
> top of the form, without any specification. In spanish "Por favor,
> corrija los siguientes errores.", i think in english "Please, fix the
> errors".
>
> For example,
>
> in models.py
>
> Class Foo(model.Models):
>   name = models.CharField(max_length=100)
>   other = models.CharField(max_length=100)
> ...
> ...
>
> in admin.py
>
> class FooAdmin(admin.ModelAdmin):
>     fieldsets = [
>         ('Data 1', {'fields': ['name',...]}),
>         ('Data 2', {'fields': ['other',..]}),
>         ]
>     fieldsets_custom= [
>         ('Data 1', {'fields': ['name',..]}),
>         ('Data 2', {'fields': ['other',...]}),
>        ]
>     readonly_fields_custom = ('name',)
>
>     def get_readonly_fields(self, request, obj=None):
>        if (request.user.is_superuser):
>           return self.readonly_fields
>        else:
>           return self.readonly_fields_custom
>
>     def get_fieldsets(self, request, obj=None):
>        if (request.user.is_superuser):
>           return super(FooAdmin, self).get_fieldsets(request,
> obj=None)
>        else :
>           return self.fieldsets_custom
>
> Any idea?
> Can i override clean() to avoid validation over name field?
> Other idea to got a custom admin form with readonly mandatory fields
> (an exclude some others)?
>
> Thanx, Mario.

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



How do I authenticate a urllib2 script in order to access HTTPS web services from a Django site?

2011-02-22 Thread carl
Hi, everyone. I've searched the group site and couldn't find anything
with this specific problem. If I missed a good discussion on this, let
me know. The following is my problem:

I'm working on a django/mod_wsgi/apache2 website that serves sensitive
information using https for all requests and responses. All views are
written to redirect if the user isn't authenticated. It also has
several views that are meant to function like RESTful web services.

I'm now in the process of writing a script that uses urllib/urllib2 to
contact several of these services in order to download a series of
very large files. I'm running into problems with 403: FORBIDDEN errors
when attempting to log in.

The (rough-draft) method I'm using for authentication and log in is:

def login( base_address, username=None, password=None ):

# prompt for the username (if needed), password
if username == None:
username = raw_input( 'Username: ' )
if password == None:
password = getpass.getpass( 'Password: ' )
log.info( 'Logging in %s' % username )

# fetch the login page in order to get the csrf token
cookieHandler = urllib2.HTTPCookieProcessor()
opener = urllib2.build_opener( urllib2.HTTPSHandler(),
cookieHandler )
urllib2.install_opener( opener )

login_url = base_address + PATH_TO_LOGIN
log.debug( "login_url: " + login_url )
login_page = opener.open( login_url )

# attempt to get the csrf token from the cookie jar
csrf_cookie = None
for cookie in cookieHandler.cookiejar:
if cookie.name == 'csrftoken':
csrf_cookie = cookie
break
if not cookie:
raise IOError( "No csrf cookie found" )
log.debug(  "found csrf cookie: " + str( csrf_cookie ) )
log.debug(  "csrf_token = %s" % csrf_cookie.value )

# login using the usr, pwd, and csrf token
login_data = urllib.urlencode( dict(
username=username, password=password,
csrfmiddlewaretoken=csrf_cookie.value ) )
log.debug( "login_data: %s" % login_data )

req = urllib2.Request( login_url, login_data )
response = urllib2.urlopen( req )
# <--- 403: FORBIDDEN here

log.debug( 'response url:\n' + str( response.geturl() ) + '\n' )
log.debug( 'response info:\n' + str( response.info() ) + '\n' )

# should redirect to the welcome page here, if back at log in -
refused
if response.geturl() == login_url:
raise IOError( 'Authentication refused' )

log.info( '\t%s is logged in' % username )
# save the cookies/opener for further actions
return opener

I'm using the HTTPCookieHandler to store Django's authentication
cookies on the script-side so I can access the web services and get
through my redirects.

Specifically, I'm getting a 403 when trying to post the credentials to
the login page/form over the https connection. This method works when
used on the development server which uses an http connection.

There is no Apache directory directive that prevents access to that
area (that I can see). The script connects successfully to the login
page without post data so I'm thinking that would leave Apache out of
the problem (but I could be wrong).

I know that the CSRFmiddleware for Django is going to bump me out if I
don't pass the csrf token along with the log in information, so I pull
that first from the first page/form load's cookiejar. Like I
mentioned, this works with the http/development version of the site.

The python installations I'm using are both compiled with SSL.

I've also read that urllib2 doesn't allow https connections via proxy.
I'm not very experienced with proxies, so I don't know if using a
script from a remote machine is actually a proxy connection and
whether that would be the problem. Is this causing the access problem?

>From what I can tell, the problem is in the combination of cookies and
the post data, but I'm unclear as to where to take it from here.

Any help would be appreciated. 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-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.



Problem with readonly_fields

2011-02-22 Thread Mario8k
Hi,

Trying to make a custom model admin form for a staff user (not a
superuser), I had to override ModelAdmin.get_readonly_fields() and
ModelAdmin.get_fieldsets(). The problem arrives when i try to change
the data of a model record, because the field is mandatory
(blank=False, as default). When i submit the form, i got an error on
top of the form, without any specification. In spanish "Por favor,
corrija los siguientes errores.", i think in english "Please, fix the
errors".

For example,

in models.py

Class Foo(model.Models):
  name = models.CharField(max_length=100)
  other = models.CharField(max_length=100)
...
...

in admin.py


class FooAdmin(admin.ModelAdmin):
fieldsets = [
('Data 1', {'fields': ['name',...]}),
('Data 2', {'fields': ['other',..]}),
]
fieldsets_custom= [
('Data 1', {'fields': ['name',..]}),
('Data 2', {'fields': ['other',...]}),
   ]
readonly_fields_custom = ('name',)

def get_readonly_fields(self, request, obj=None):
   if (request.user.is_superuser):
  return self.readonly_fields
   else:
  return self.readonly_fields_custom

def get_fieldsets(self, request, obj=None):
   if (request.user.is_superuser):
  return super(FooAdmin, self).get_fieldsets(request,
obj=None)
   else :
  return self.fieldsets_custom


Any idea?
Can i override clean() to avoid validation over name field?
Other idea to got a custom admin form with readonly mandatory fields
(an exclude some others)?

Thanx, Mario.

-- 
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: Unexpected result from making single object query

2011-02-22 Thread Daniel Roseman
On Tuesday, February 22, 2011 9:35:18 PM UTC, mm wrote:
>
> the next field in the Entry table contain the name of the next entry 
> the prev field in the Entry table contain the name of the previous 
> entry. 
>
> current_entry = Entry.objects.get(id=10) 
>
> next_entry = Entry.objects.get(next=current_entry.next) 
> prev_entry = Entry.objects.get(prev=current_entry.prev) 
>
> For business reason, we used the name of the entry instead of the ID. 
>
>  
OK. Now think about the query you're making.

"Give me the Entry object where the 'next' field is the same as the current 
entry's 'next' field". Can you see why that's giving you the wrong answer?
--
DR.

-- 
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: Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-22 Thread Bobby Roberts
Hey Daniel -

we've got {% load thumbnail%} at the top of the template (a standard
satchmo template anyway)... running version 3.2.5 for sorl.




On Feb 22, 4:25 pm, Daniel Roseman  wrote:
> On Tuesday, February 22, 2011 6:22:16 PM UTC, Bobby Roberts wrote:
>
> > Hi group.  I've posted this in the satchmo group but am posting here
> > as well in hopes of getting some help.
>
> > This error is caused by this code:
>
> > {% if product.main_image %}
> >               
> >               {% thumbnail product.main_image.picture 85x85 as image
> > %}
> >                > src="{{ image }}" width="{{ image.width }}"
> > height="{{ image.height }}" />
> >               
> > {% endif %}
>
> > it makes use of sorl thumbnail to resize images on the fly i believe.
> > We can import sorl thumbnail into python from command line just fine.
>
> > If anyone uses satchmo for their ecommerce store have you run into
> > this error?  How did you resolve.  Please help and thank you in
> > advance.
>
> You haven't loaded the template tag library that defines the thumbnail tag.
>
>     {% load thumbnail_tags %}
>
> or whatever.
> --
> DR.

-- 
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: Unexpected result from making single object query

2011-02-22 Thread delegbede
First, confirm the relationship between those variables. 
current_entry = Entry.objects.get(id=10)
next_entry = Entry.objects.get(current_entry.next)
prev_entry = Entry.objects.get(current_entry.prev)
By my estimation,next_entry should return Entry object with I'd of 11 while  
prev_entry returns I'd of 9. That you're not getting any error doesn't 
necessarily mean you're correct. You might have to do a dir(Entry.objects) to 
get all possible methods. 
Regards.
Sent from my BlackBerry wireless device from MTN

-Original Message-
From: mm 
Sender: django-users@googlegroups.com
Date: Tue, 22 Feb 2011 12:30:27 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Unexpected result from making single object query

I am not sure what I am doing wrong but there is my code:

current_entry = Entry.objects.get(id=10)

next_entry = Entry.objects.get(current_entry.next)
prev_entry = Entry.objects.get(current_entry.prev)

where current_entry.next and current_entry.prev columns contained the
name of the previous and next entry.  No matter what I do, the return
value of the next_entry and prev_entry are always the same value of
current_entry.  I run this in interactive shell environment also but I
get the same result.  Please help.  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-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 format django template code nicely with notepad++?

2011-02-22 Thread delegbede
The ssh thing, I agree. It works like magic. I'm however compelled to believe 
that the time you'd spend learning VI is enough to get you already developing 
django powered apps. My case study. 
Sent from my BlackBerry wireless device from MTN

-Original Message-
From: Brice Leroy 
Sender: django-users@googlegroups.com
Date: Tue, 22 Feb 2011 11:20:21 
To: 
Reply-To: django-users@googlegroups.com
Cc: mongoose
Subject: Re: How to format django template code nicely with notepad++?

Learning VI is good for you and it makes you fast. Learning curve is steep,
I agree, but the result is quite amazing. One other big advantage, you can
easily work on any server through SSH.

2011/2/22 mongoose 

> I used vim for a while but the learning curve really is steep. so
> steep that i'm more effecient with the old style editors. perhaps i'll
> just do what i do in notepad++ then format it in vim. i'll keep
> looking around for a nice formatter though.
>
> On Feb 22, 5:20 pm, Bill Freeman  wrote:
> > You *could* use Tidy, then post process with a sed script to convert
> > the '%20's to spaces.
> >
> > There may be comparable Windows tool, but if you want sed, you can
> > install Cygwin.
> >
> > But if you install Cygwin, you could edit with vim.
> >
> > Since you're editing templates, you probably have python installed.
> > If there isn't already a python based template reformatter, that
> > sounds like an obvious project.  It would still be outside your
> > editor, however.  I really want formatting aid inside my editor
> > (spoiled emacs user).  Perhaps an extension to IDLE?
> >
> > On Tue, Feb 22, 2011 at 9:55 AM, mongoose 
> wrote:
> > > hi all,
> >
> > > I'm using notepad++ a lot and really missing a code formatter (vim
> > > would be = to format).
> > > Anyone know of anyway to format my html nicely? I've tried HTML Tidy
> > > but it keeps adding a 20% where I have a space for example
> > > "{{%20MEDIA_URL%20}}css/styles.css".
> >
> > > --
> > > 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 athttp://
> 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.
>
>


-- 
blog: http://www.debrice.com
project: http://alpha.kaaloo.com http://alpha.djangogenerator.com
linkedin: http://www.linkedin.com/in/bricepleroy

-- 
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: Unexpected result from making single object query

2011-02-22 Thread mm
I see where my problem is.  I should use the name field instead:

next_entry = Entry.objects.get(name=current_entry.next)
prev_entry = Entry.objects.get(name=current_entry.prev)

thanks

On Feb 22, 3:35 pm, mm  wrote:
> the next field in the Entry table contain the name of the next entry
> the prev field in the Entry table contain the name of the previous
> entry.
>
> current_entry = Entry.objects.get(id=10)
>
> next_entry = Entry.objects.get(next=current_entry.next)
> prev_entry = Entry.objects.get(prev=current_entry.prev)
>
> For business reason, we used the name of the entry instead of the ID.
>
> On Feb 22, 2:35 pm, Shawn Milochik  wrote:
>
> > What do the 'next' and 'prev' methods of your Entry model do?
>
> > 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: Unexpected result from making single object query

2011-02-22 Thread mm
the next field in the Entry table contain the name of the next entry
the prev field in the Entry table contain the name of the previous
entry.

current_entry = Entry.objects.get(id=10)

next_entry = Entry.objects.get(next=current_entry.next)
prev_entry = Entry.objects.get(prev=current_entry.prev)

For business reason, we used the name of the entry instead of the ID.



On Feb 22, 2:35 pm, Shawn Milochik  wrote:
> What do the 'next' and 'prev' methods of your Entry model do?
>
> 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: Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-22 Thread Bobby Roberts

hey daniel -

we've got {%load thumbnail%} at the top of the standard satchmo
template.


On Feb 22, 4:25 pm, Daniel Roseman  wrote:
> On Tuesday, February 22, 2011 6:22:16 PM UTC, Bobby Roberts wrote:
>
> > Hi group.  I've posted this in the satchmo group but am posting here
> > as well in hopes of getting some help.
>
> > This error is caused by this code:
>
> > {% if product.main_image %}
> >               
> >               {% thumbnail product.main_image.picture 85x85 as image
> > %}
> >                > src="{{ image }}" width="{{ image.width }}"
> > height="{{ image.height }}" />
> >               
> > {% endif %}
>
> > it makes use of sorl thumbnail to resize images on the fly i believe.
> > We can import sorl thumbnail into python from command line just fine.
>
> > If anyone uses satchmo for their ecommerce store have you run into
> > this error?  How did you resolve.  Please help and thank you in
> > advance.
>
> You haven't loaded the template tag library that defines the thumbnail tag.
>
>     {% load thumbnail_tags %}
>
> or whatever.
> --
> DR.

-- 
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 merge querysets and sort it?

2011-02-22 Thread delegbede
I'm not so sure if I'm answering your question but there's a way you can chain 
querysets. 
In your views.py file import Q from django.db.models. 
You could check django documentation. I think it works well. 
Sent from my BlackBerry wireless device from MTN

-Original Message-
From: Ryan Wijaya 
Sender: django-users@googlegroups.com
Date: Tue, 22 Feb 2011 07:01:49 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: How to merge querysets and sort it?

For me it takes more than a week to solve it alone...
So to the point, is it possible to merge two querysets and sort it as
well?
Recently I've used itertools, but it returns a table with duplicated
value and requested objects not properly displayed (the get_full_name
displayed separately with other, creating a new row)


here's the codes
views.py

def view_siswa(request):
# list_detail.object_list, {"queryset": Data_Siswa.objects.all(),
"template_name": "views/view-siswa-list.html"}
namasiswa = User.objects.all().exclude(is_staff='false')
datasiswa = Data_Siswa.objects.all().order_by('kode_nis')
query = chain(datasiswa, namasiswa)
variables = RequestContext(request, {'siswa':query,})
# variables = RequestContext(request, {'siswa':datasiswa,})
return render_to_response(
'views/view-siswa-list.html',
# { 'siswa':namasiswa, 'datasiswa': datasiswa, }
variables,
)


template

{% for object in siswa %}

{{ object.username 
}}
{{ object.kode_nis }}
{{ object.first_name }}
{{ object.kode_jurusan }}
Lihat
Edit

{% endfor %}


Muchly appreciated any help... btw I'm new in Django

Regards

Rian

-- 
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 format django template code nicely with notepad++?

2011-02-22 Thread Daniel Roseman
On Tuesday, February 22, 2011 8:31:43 PM UTC, mongoose wrote:
>
> want to get vim working with omnicomplete then perhaps i'll get into 
> it more. 
>
> I've added this to my vimrc file 
>
> filetype plugin on 
> set ofu=syntaxcomplete#Complete 
>
> when i try 
> :python print 'hello' 
> i get this error 
> "Could not load library python26.dll 
> The python library could not be loaded." 
>
> first of all i have python 2.7 installed. second how can i specify 
> where vim needs to look to find the dll? 
>
>
You'll need to compile vim with Python support, if it doesn't already have 
it. vim doesn't use the installed Python, it has to be compiled in.

--
DR. 

-- 
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 format django template code nicely with notepad++?

2011-02-22 Thread Brice Leroy
Might seam rude but you should try coding on linux. Some easy distribution
like ubuntu. You can even install it in a virtual environment with virtual
box.

2011/2/22 

> You might want to try Activestate Komodo Edit.
> That's what I use and it's such a wonderful experience.
> Regards.
> Sent from my BlackBerry wireless device from MTN
>
> -Original Message-
> From: mongoose 
> Sender: django-users@googlegroups.com
> Date: Tue, 22 Feb 2011 06:55:21
> To: Django users
> Reply-To: django-users@googlegroups.com
> Subject: How to format django template code nicely with notepad++?
>
> hi all,
>
> I'm using notepad++ a lot and really missing a code formatter (vim
> would be = to format).
> Anyone know of anyway to format my html nicely? I've tried HTML Tidy
> but it keeps adding a 20% where I have a space for example
> "{{%20MEDIA_URL%20}}css/styles.css".
>
> --
> 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.
>
>


-- 
blog: http://www.debrice.com
project: http://alpha.kaaloo.com http://alpha.djangogenerator.com
linkedin: http://www.linkedin.com/in/bricepleroy

-- 
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: Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-22 Thread Daniel Roseman
On Tuesday, February 22, 2011 6:22:16 PM UTC, Bobby Roberts wrote:
>
> Hi group.  I've posted this in the satchmo group but am posting here 
> as well in hopes of getting some help. 
>
> This error is caused by this code: 
>
> {% if product.main_image %} 
>
>   {% thumbnail product.main_image.picture 85x85 as image 
> %} 
>src="{{ image }}" width="{{ image.width }}" 
> height="{{ image.height }}" /> 
>
> {% endif %} 
>
>
>
> it makes use of sorl thumbnail to resize images on the fly i believe. 
> We can import sorl thumbnail into python from command line just fine. 
>
> If anyone uses satchmo for their ecommerce store have you run into 
> this error?  How did you resolve.  Please help and thank you in 
> advance. 
>
>
You haven't loaded the template tag library that defines the thumbnail tag.

{% load thumbnail_tags %}

or whatever.
--
DR. 

-- 
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: Unexpected result from making single object query

2011-02-22 Thread Daniel Roseman
On Tuesday, February 22, 2011 8:30:27 PM UTC, mm wrote:
>
> I am not sure what I am doing wrong but there is my code: 
>
> current_entry = Entry.objects.get(id=10) 
>
> next_entry = Entry.objects.get(current_entry.next) 
> prev_entry = Entry.objects.get(current_entry.prev) 
>
> where current_entry.next and current_entry.prev columns contained the 
> name of the previous and next entry.  No matter what I do, the return 
> value of the next_entry and prev_entry are always the same value of 
> current_entry.  I run this in interactive shell environment also but I 
> get the same result.  Please help.  Thanks. 
>
>
What do you mean, "the name of the previous entry"? How is that supposed to 
work? Surely you can see that 
x.get(id=10) 
is not the same format as
x.get(string)

--
DR.

-- 
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 format django template code nicely with notepad++?

2011-02-22 Thread delegbede
You might want to try Activestate Komodo Edit. 
That's what I use and it's such a wonderful experience. 
Regards. 
Sent from my BlackBerry wireless device from MTN

-Original Message-
From: mongoose 
Sender: django-users@googlegroups.com
Date: Tue, 22 Feb 2011 06:55:21 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: How to format django template code nicely with notepad++?

hi all,

I'm using notepad++ a lot and really missing a code formatter (vim
would be = to format).
Anyone know of anyway to format my html nicely? I've tried HTML Tidy
but it keeps adding a 20% where I have a space for example
"{{%20MEDIA_URL%20}}css/styles.css".

-- 
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 format django template code nicely with notepad++?

2011-02-22 Thread Bill Freeman
what happens if you type:

  python

at the Cygwin shell prompt?

And what does it say if you type:

  which python

On Tue, Feb 22, 2011 at 3:31 PM, mongoose  wrote:
> want to get vim working with omnicomplete then perhaps i'll get into
> it more.
>
> I've added this to my vimrc file
>
> filetype plugin on
> set ofu=syntaxcomplete#Complete
>
> when i try
> :python print 'hello'
> i get this error
> "Could not load library python26.dll
> The python library could not be loaded."
>
> first of all i have python 2.7 installed. second how can i specify
> where vim needs to look to find the dll?
>
>
> On Feb 22, 5:20 pm, Bill Freeman  wrote:
>> You *could* use Tidy, then post process with a sed script to convert
>> the '%20's to spaces.
>>
>> There may be comparable Windows tool, but if you want sed, you can
>> install Cygwin.
>>
>> But if you install Cygwin, you could edit with vim.
>>
>> Since you're editing templates, you probably have python installed.
>> If there isn't already a python based template reformatter, that
>> sounds like an obvious project.  It would still be outside your
>> editor, however.  I really want formatting aid inside my editor
>> (spoiled emacs user).  Perhaps an extension to IDLE?
>>
>> On Tue, Feb 22, 2011 at 9:55 AM, mongoose  wrote:
>> > hi all,
>>
>> > I'm using notepad++ a lot and really missing a code formatter (vim
>> > would be = to format).
>> > Anyone know of anyway to format my html nicely? I've tried HTML Tidy
>> > but it keeps adding a 20% where I have a space for example
>> > "{{%20MEDIA_URL%20}}css/styles.css".
>>
>> > --
>> > 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 
>> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unexpected result from making single object query

2011-02-22 Thread Shawn Milochik
What do the 'next' and 'prev' methods of your Entry model do?

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: How to format django template code nicely with notepad++?

2011-02-22 Thread mongoose
want to get vim working with omnicomplete then perhaps i'll get into
it more.

I've added this to my vimrc file

filetype plugin on
set ofu=syntaxcomplete#Complete

when i try
:python print 'hello'
i get this error
"Could not load library python26.dll
The python library could not be loaded."

first of all i have python 2.7 installed. second how can i specify
where vim needs to look to find the dll?


On Feb 22, 5:20 pm, Bill Freeman  wrote:
> You *could* use Tidy, then post process with a sed script to convert
> the '%20's to spaces.
>
> There may be comparable Windows tool, but if you want sed, you can
> install Cygwin.
>
> But if you install Cygwin, you could edit with vim.
>
> Since you're editing templates, you probably have python installed.
> If there isn't already a python based template reformatter, that
> sounds like an obvious project.  It would still be outside your
> editor, however.  I really want formatting aid inside my editor
> (spoiled emacs user).  Perhaps an extension to IDLE?
>
> On Tue, Feb 22, 2011 at 9:55 AM, mongoose  wrote:
> > hi all,
>
> > I'm using notepad++ a lot and really missing a code formatter (vim
> > would be = to format).
> > Anyone know of anyway to format my html nicely? I've tried HTML Tidy
> > but it keeps adding a 20% where I have a space for example
> > "{{%20MEDIA_URL%20}}css/styles.css".
>
> > --
> > 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 
> > athttp://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.



Unexpected result from making single object query

2011-02-22 Thread mm
I am not sure what I am doing wrong but there is my code:

current_entry = Entry.objects.get(id=10)

next_entry = Entry.objects.get(current_entry.next)
prev_entry = Entry.objects.get(current_entry.prev)

where current_entry.next and current_entry.prev columns contained the
name of the previous and next entry.  No matter what I do, the return
value of the next_entry and prev_entry are always the same value of
current_entry.  I run this in interactive shell environment also but I
get the same result.  Please help.  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-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 reinstall Python Interpreters?

2011-02-22 Thread LJ
Yes.  I used the apt-get install command to install dajaxice, but it
installs an older version, and the installer for the newer version
isn't done.
The installer for the older version does not put anything in the dist-
packages directory.  I'm trying to figure out how to manually install
it, but I'm not making any progress.

On Feb 18, 8:07 pm, lduros  wrote:
> Did you install dajaxice through apt-get? From the command line: sudo
> apt-get install python-django-dajaxice
> If not, you might want to try it it might do the trick of installing
> it in a much easier way than from the sources.
>
> On Feb 18, 5:04 pm, LJ  wrote:
>
> > Just adding a note for anyone else struggling with a similar
> > 'unresolved import' problem...
> > This article explains in details how to modify the PYTHONPATH if you
> > decide to go that route.
> >  http://www.stereoplex.com/blog/understanding-imports-and-pythonpath
> > I don't prefer to use this method, but I now understand how django is
> > able to find imported libraries.
>
> > I am still looking for a good article on how to install/configure a
> > 3rd party app in site packages--or dist-packages on Ubuntu (Python
> > 2.6).
>
> > On Feb 18, 12:39 pm, LJ  wrote:
>
> > > I am on Ubuntu 10, using Python 2.6 and Django 1.2.3.
> > > Mike Ramirez suggested that I look at the site packages (in my case
> > > dist-packages) in my python lib dir.
> > > I did not see anything in there that references dajaxice.  I may need
> > > to manually edit the PYTHONPATH once I figure out how and where.
>
> > > My errors are:
> > > Unresolved import: dajaxice_autodiscover
> > > Unresolved import: dajaxice_functions
>
> > > On Feb 18, 7:17 am, CrabbyPete  wrote:
>
> > > > I wouldn't reinstall python because of an unresolved import error.
> > > > What's unresolved and what type of system are you on PC/Linux?
>
> > > > On Feb 17, 7:48 pm, LJ  wrote:
>
> > > > > I installed the latest version of dajaxice, but I am still getting
> > > > > Unresolved import errors.
> > > > > My guess is that I need to remove and reinstall the Python
> > > > > Interpreters.
> > > > > Is there a some documentation somewhere that explains how to reinstall
> > > > > the Python Interpreters, so I can resolve all of my Unresolved Import
> > > > > errors?

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



database i18n

2011-02-22 Thread Federico Capoano
I'm quite surprised that django doesn't have a native i18n solution
for models.

I've been trying some apps but one doesn't work with latest versions,
one is no longer developed, another one has no documentation, another
one simply doesn't work.

Tomorrow I'm going to try again and pheraps try some new ones.

What is your opinion regarding this matter? Is there an app you
suggest?

-- 
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: Question(s) Concerning Securing Pages From Bots?

2011-02-22 Thread Casey S. Greene
The term that you are looking for is "captcha."  If you google for: 
django captcha


you will find a wealth of information.

Hope this helps!
Casey

On 02/22/2011 01:09 PM, hank23 wrote:

On some web pages the user is prompted to type in a series of randomly
generated characters which appear on the screen, in order to limit
access of those pages to real users instead of allowing bots to also
access them. Now my question is is there a plug-in, sample code, or
outright django documentation for doing something like that in a
django/python web application? If so can someone point me to it?
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-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 format django template code nicely with notepad++?

2011-02-22 Thread Bill Freeman
Except beware of using vi/vim to edit .py files since they are normally
configured to use tabs for indentation and to assume that a tab means
4 columns, whereas python (correct in the view of a really old timer)
takes them to mean 8 columns.

It is possible to configure at least vim to never insert tab characters
and to convert them to the right number of spaces for 8 columns on
reading a .py file.  But that's a separate issue.

On Tue, Feb 22, 2011 at 2:20 PM, Brice Leroy  wrote:
> Learning VI is good for you and it makes you fast. Learning curve is steep,
> I agree, but the result is quite amazing. One other big advantage, you can
> easily work on any server through SSH.
>
> 2011/2/22 mongoose 
>>
>> I used vim for a while but the learning curve really is steep. so
>> steep that i'm more effecient with the old style editors. perhaps i'll
>> just do what i do in notepad++ then format it in vim. i'll keep
>> looking around for a nice formatter though.
>>
>> On Feb 22, 5:20 pm, Bill Freeman  wrote:
>> > You *could* use Tidy, then post process with a sed script to convert
>> > the '%20's to spaces.
>> >
>> > There may be comparable Windows tool, but if you want sed, you can
>> > install Cygwin.
>> >
>> > But if you install Cygwin, you could edit with vim.
>> >
>> > Since you're editing templates, you probably have python installed.
>> > If there isn't already a python based template reformatter, that
>> > sounds like an obvious project.  It would still be outside your
>> > editor, however.  I really want formatting aid inside my editor
>> > (spoiled emacs user).  Perhaps an extension to IDLE?
>> >
>> > On Tue, Feb 22, 2011 at 9:55 AM, mongoose 
>> > wrote:
>> > > hi all,
>> >
>> > > I'm using notepad++ a lot and really missing a code formatter (vim
>> > > would be = to format).
>> > > Anyone know of anyway to format my html nicely? I've tried HTML Tidy
>> > > but it keeps adding a 20% where I have a space for example
>> > > "{{%20MEDIA_URL%20}}css/styles.css".
>> >
>> > > --
>> > > 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
>> > > athttp://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.
>>
>
>
>
> --
> blog: http://www.debrice.com
> project: http://alpha.kaaloo.com http://alpha.djangogenerator.com
> linkedin: http://www.linkedin.com/in/bricepleroy
>
> --
> 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 format django template code nicely with notepad++?

2011-02-22 Thread Brice Leroy
Learning VI is good for you and it makes you fast. Learning curve is steep,
I agree, but the result is quite amazing. One other big advantage, you can
easily work on any server through SSH.

2011/2/22 mongoose 

> I used vim for a while but the learning curve really is steep. so
> steep that i'm more effecient with the old style editors. perhaps i'll
> just do what i do in notepad++ then format it in vim. i'll keep
> looking around for a nice formatter though.
>
> On Feb 22, 5:20 pm, Bill Freeman  wrote:
> > You *could* use Tidy, then post process with a sed script to convert
> > the '%20's to spaces.
> >
> > There may be comparable Windows tool, but if you want sed, you can
> > install Cygwin.
> >
> > But if you install Cygwin, you could edit with vim.
> >
> > Since you're editing templates, you probably have python installed.
> > If there isn't already a python based template reformatter, that
> > sounds like an obvious project.  It would still be outside your
> > editor, however.  I really want formatting aid inside my editor
> > (spoiled emacs user).  Perhaps an extension to IDLE?
> >
> > On Tue, Feb 22, 2011 at 9:55 AM, mongoose 
> wrote:
> > > hi all,
> >
> > > I'm using notepad++ a lot and really missing a code formatter (vim
> > > would be = to format).
> > > Anyone know of anyway to format my html nicely? I've tried HTML Tidy
> > > but it keeps adding a 20% where I have a space for example
> > > "{{%20MEDIA_URL%20}}css/styles.css".
> >
> > > --
> > > 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 athttp://
> 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.
>
>


-- 
blog: http://www.debrice.com
project: http://alpha.kaaloo.com http://alpha.djangogenerator.com
linkedin: http://www.linkedin.com/in/bricepleroy

-- 
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 tag displayed in different tabs

2011-02-22 Thread Maverick
Hi,

I am newbie for django frameworks. I have a one webpage which consists
of different tabs. In each different tabs consist of different custom
tag fields.

But i want to show one custom tag field which is used in one or more
tab. How to show this field in both the tabs.?

For example:

I have three tabs named like Foo Bar Baz. In each tab am having some
custom tags.

Foo tab contains Name, Address fields
Bar tab contains Education, curricularinfo fields.
Baz tab contains Name, Hobbies etc.

Basically I want to show the Name field to be displayed in Foo and Baz
tab. I have tried that and it is showed. But the problem is its
duplicated  the same element with same element id in the page.

I want to show the same field without duplicate in the same page.
While am doing some operations for the particular element using
Jquery. Its not responding for the Baz tab Name field.

Could anybody please give me some pointers to solve this?

Thanks in Advance,

Regards
- Maverick.

-- 
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 format django template code nicely with notepad++?

2011-02-22 Thread mongoose
I used vim for a while but the learning curve really is steep. so
steep that i'm more effecient with the old style editors. perhaps i'll
just do what i do in notepad++ then format it in vim. i'll keep
looking around for a nice formatter though.

On Feb 22, 5:20 pm, Bill Freeman  wrote:
> You *could* use Tidy, then post process with a sed script to convert
> the '%20's to spaces.
>
> There may be comparable Windows tool, but if you want sed, you can
> install Cygwin.
>
> But if you install Cygwin, you could edit with vim.
>
> Since you're editing templates, you probably have python installed.
> If there isn't already a python based template reformatter, that
> sounds like an obvious project.  It would still be outside your
> editor, however.  I really want formatting aid inside my editor
> (spoiled emacs user).  Perhaps an extension to IDLE?
>
> On Tue, Feb 22, 2011 at 9:55 AM, mongoose  wrote:
> > hi all,
>
> > I'm using notepad++ a lot and really missing a code formatter (vim
> > would be = to format).
> > Anyone know of anyway to format my html nicely? I've tried HTML Tidy
> > but it keeps adding a 20% where I have a space for example
> > "{{%20MEDIA_URL%20}}css/styles.css".
>
> > --
> > 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 
> > athttp://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: Askani

2011-02-22 Thread Cal Leeming [Simplicity Media Ltd]
(re-sent)

I have to disagree.

Although it would be interesting to hear other peoples thoughts on this as
well.

On Tue, Feb 22, 2011 at 6:45 PM, Brice Leroy  wrote:

> Actually it doesn't. You'll still have to design your data model and
> interactions. Coding basic model, urls, forms etc... is definitely boring.
> This takes care of those repetitive tasks and let you the fun of
> customization
>
> 2011/2/22 Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk>
>
>> I'm sure these will be useful to someone, but it kinda takes the fun out
>> of designing a structure from scratch :(
>>
>>
>> On Tue, Feb 22, 2011 at 5:47 PM, Brice Leroy wrote:
>>
>>> You should try http://www.djangogenerator.com
>>>
>>> - Generate model
>>> - Views
>>> - Forms
>>> - Urls
>>>
>>> and manage User profile extesion
>>>
>>> Brice
>>>
>>> 2010/11/26 Wim Feijen 
>>>
 Nice! It definitely saves typing. Sounds like a right thing for
 newbies, because when I was a newbie, I always had to look up which
 fieldname to use and oh the typos.

 Wim

 On Nov 20, 3:28 pm, Alvaro Mouriño  wrote:
 > Hi.
 >
 > I'd like to introduce to you this idea I've been working on for the
 > last month, a django models generator:http://askani.net/
 >
 > Field options definition it's repetitive. Writing meta options leads
 > to inconsistent use due to the variety available. "Inspired" by the
 > repetitiveness of coding django models and the required memory load of
 > defining meta options I decided to create a graphical interface that
 > would guide the user in the creation of models.
 >
 > Askani.net is the result of scratching those itches. It represents
 > models, fields, attributes and meta options in a UML-and-MER-ish way
 > (but doesn't follow it strictly). It displays all the possible
 > information for a model so the user only has to fill in the blanks the
 > desired options, not remember all of them.
 >
 > The python code that outputs it's far from perfect, I know, this is
 > just a barely-usable system to prove the concept, a prototype.
 >
 > The reason for this email is to request comments, suggestions and
 > critics on the idea and specially on the usability. Clone the source,
 > read the README file and play with it. Have fun =)
 >
 > Regards,
 >
 > --
 > Alvaro Mouriñohttp://askani.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-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.


>>>
>>>
>>> --
>>> blog: http://www.debrice.com
>>> project: http://alpha.kaaloo.com http://alpha.djangogenerator.com
>>> linkedin: http://www.linkedin.com/in/bricepleroy
>>>
>>> --
>>> 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.
>>>
>>
>>
>
>
> --
> blog: http://www.debrice.com
> project: http://alpha.kaaloo.com http://alpha.djangogenerator.com
> linkedin: http://www.linkedin.com/in/bricepleroy
>

-- 
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: Cool and useful development commands :-)

2011-02-22 Thread Cal Leeming [Simplicity Media Ltd]
Haven't had chance to look at it properly yet, but looks like a useful set
of tools. I'll download and have a tinker around later :)

On Tue, Feb 22, 2011 at 4:46 PM, Simone Federici wrote:

> http://www.os4d.org/djangodevtools
> Your feedback is very welcome
>
> Simone
>
> --
> 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: Askani

2011-02-22 Thread Brice Leroy
Actually it doesn't. You'll still have to design your data model and
interactions. Coding basic model, urls, forms etc... is definitely boring.
This takes care of those repetitive tasks and let you the fun of
customization

2011/2/22 Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk>

> I'm sure these will be useful to someone, but it kinda takes the fun out of
> designing a structure from scratch :(
>
> On Tue, Feb 22, 2011 at 5:47 PM, Brice Leroy  wrote:
>
>> You should try http://www.djangogenerator.com
>>
>> - Generate model
>> - Views
>> - Forms
>> - Urls
>>
>> and manage User profile extesion
>>
>> Brice
>>
>> 2010/11/26 Wim Feijen 
>>
>>> Nice! It definitely saves typing. Sounds like a right thing for
>>> newbies, because when I was a newbie, I always had to look up which
>>> fieldname to use and oh the typos.
>>>
>>> Wim
>>>
>>> On Nov 20, 3:28 pm, Alvaro Mouriño  wrote:
>>> > Hi.
>>> >
>>> > I'd like to introduce to you this idea I've been working on for the
>>> > last month, a django models generator:http://askani.net/
>>> >
>>> > Field options definition it's repetitive. Writing meta options leads
>>> > to inconsistent use due to the variety available. "Inspired" by the
>>> > repetitiveness of coding django models and the required memory load of
>>> > defining meta options I decided to create a graphical interface that
>>> > would guide the user in the creation of models.
>>> >
>>> > Askani.net is the result of scratching those itches. It represents
>>> > models, fields, attributes and meta options in a UML-and-MER-ish way
>>> > (but doesn't follow it strictly). It displays all the possible
>>> > information for a model so the user only has to fill in the blanks the
>>> > desired options, not remember all of them.
>>> >
>>> > The python code that outputs it's far from perfect, I know, this is
>>> > just a barely-usable system to prove the concept, a prototype.
>>> >
>>> > The reason for this email is to request comments, suggestions and
>>> > critics on the idea and specially on the usability. Clone the source,
>>> > read the README file and play with it. Have fun =)
>>> >
>>> > Regards,
>>> >
>>> > --
>>> > Alvaro Mouriñohttp://askani.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-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.
>>>
>>>
>>
>>
>> --
>> blog: http://www.debrice.com
>> project: http://alpha.kaaloo.com http://alpha.djangogenerator.com
>> linkedin: http://www.linkedin.com/in/bricepleroy
>>
>> --
>> 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.
>>
>
>


-- 
blog: http://www.debrice.com
project: http://alpha.kaaloo.com http://alpha.djangogenerator.com
linkedin: http://www.linkedin.com/in/bricepleroy

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



ANN: Security release issued for the django CMS

2011-02-22 Thread Jonas Obrist
Today the Django CMS team is issuing a security release for the 2.1 
series, version 2.1.3, to fix a serious security issue. All 2.1 releases 
as well as any git checkout newer than April 8th 2010 are affected and 
anyone using any of these versions is strongly urged to upgrade immediately.


For details please refer to the blog post here:

https://django-cms.org/en/blog/2011/02/22/security-releasse-issued/

Jonas Obrist

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



Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-22 Thread Bobby Roberts
Hi group.  I've posted this in the satchmo group but am posting here
as well in hopes of getting some help.

This error is caused by this code:

{% if product.main_image %}
  
  {% thumbnail product.main_image.picture 85x85 as image
%}
  
  
{% endif %}



it makes use of sorl thumbnail to resize images on the fly i believe.
We can import sorl thumbnail into python from command line just fine.

If anyone uses satchmo for their ecommerce store have you run into
this error?  How did you resolve.  Please help and thank you in
advance.

-- 
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: Question(s) Concerning Securing Pages From Bots?

2011-02-22 Thread Cal Leeming [Simplicity Media Ltd]
http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=django+captcha

Not
busting your balls but, please at least make an effort to look on Google
before posting questions to the list.

On Tue, Feb 22, 2011 at 6:09 PM, hank23  wrote:

> On some web pages the user is prompted to type in a series of randomly
> generated characters which appear on the screen, in order to limit
> access of those pages to real users instead of allowing bots to also
> access them. Now my question is is there a plug-in, sample code, or
> outright django documentation for doing something like that in a
> django/python web application? If so can someone point me to it?
> 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-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: Askani

2011-02-22 Thread Cal Leeming [Simplicity Media Ltd]
I'm sure these will be useful to someone, but it kinda takes the fun out of
designing a structure from scratch :(

On Tue, Feb 22, 2011 at 5:47 PM, Brice Leroy  wrote:

> You should try http://www.djangogenerator.com
>
> - Generate model
> - Views
> - Forms
> - Urls
>
> and manage User profile extesion
>
> Brice
>
> 2010/11/26 Wim Feijen 
>
>> Nice! It definitely saves typing. Sounds like a right thing for
>> newbies, because when I was a newbie, I always had to look up which
>> fieldname to use and oh the typos.
>>
>> Wim
>>
>> On Nov 20, 3:28 pm, Alvaro Mouriño  wrote:
>> > Hi.
>> >
>> > I'd like to introduce to you this idea I've been working on for the
>> > last month, a django models generator:http://askani.net/
>> >
>> > Field options definition it's repetitive. Writing meta options leads
>> > to inconsistent use due to the variety available. "Inspired" by the
>> > repetitiveness of coding django models and the required memory load of
>> > defining meta options I decided to create a graphical interface that
>> > would guide the user in the creation of models.
>> >
>> > Askani.net is the result of scratching those itches. It represents
>> > models, fields, attributes and meta options in a UML-and-MER-ish way
>> > (but doesn't follow it strictly). It displays all the possible
>> > information for a model so the user only has to fill in the blanks the
>> > desired options, not remember all of them.
>> >
>> > The python code that outputs it's far from perfect, I know, this is
>> > just a barely-usable system to prove the concept, a prototype.
>> >
>> > The reason for this email is to request comments, suggestions and
>> > critics on the idea and specially on the usability. Clone the source,
>> > read the README file and play with it. Have fun =)
>> >
>> > Regards,
>> >
>> > --
>> > Alvaro Mouriñohttp://askani.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-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.
>>
>>
>
>
> --
> blog: http://www.debrice.com
> project: http://alpha.kaaloo.com http://alpha.djangogenerator.com
> linkedin: http://www.linkedin.com/in/bricepleroy
>
> --
> 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.



Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'

2011-02-22 Thread Bobby Roberts
Hi group.  I've posted this in the satchmo group but am posting here
as well in hopes of getting some help.

This error is caused by this code:

{% if product.main_image %}
  
  {% thumbnail product.main_image.picture 85x85 as image
%}
  
  
{% endif %}



it makes use of sorl thumbnail to resize images on the fly i believe.
We can import sorl thumbnail into python from command line just fine.

If anyone uses satchmo for their ecommerce store have you run into
this error?  How did you resolve.  Please help and thank you in
advance.

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



Question(s) Concerning Securing Pages From Bots?

2011-02-22 Thread hank23
On some web pages the user is prompted to type in a series of randomly
generated characters which appear on the screen, in order to limit
access of those pages to real users instead of allowing bots to also
access them. Now my question is is there a plug-in, sample code, or
outright django documentation for doing something like that in a
django/python web application? If so can someone point me to it?
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-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: Askani

2011-02-22 Thread Brice Leroy
You should try http://www.djangogenerator.com

- Generate model
- Views
- Forms
- Urls

and manage User profile extesion

Brice

2010/11/26 Wim Feijen 

> Nice! It definitely saves typing. Sounds like a right thing for
> newbies, because when I was a newbie, I always had to look up which
> fieldname to use and oh the typos.
>
> Wim
>
> On Nov 20, 3:28 pm, Alvaro Mouriño  wrote:
> > Hi.
> >
> > I'd like to introduce to you this idea I've been working on for the
> > last month, a django models generator:http://askani.net/
> >
> > Field options definition it's repetitive. Writing meta options leads
> > to inconsistent use due to the variety available. "Inspired" by the
> > repetitiveness of coding django models and the required memory load of
> > defining meta options I decided to create a graphical interface that
> > would guide the user in the creation of models.
> >
> > Askani.net is the result of scratching those itches. It represents
> > models, fields, attributes and meta options in a UML-and-MER-ish way
> > (but doesn't follow it strictly). It displays all the possible
> > information for a model so the user only has to fill in the blanks the
> > desired options, not remember all of them.
> >
> > The python code that outputs it's far from perfect, I know, this is
> > just a barely-usable system to prove the concept, a prototype.
> >
> > The reason for this email is to request comments, suggestions and
> > critics on the idea and specially on the usability. Clone the source,
> > read the README file and play with it. Have fun =)
> >
> > Regards,
> >
> > --
> > Alvaro Mouriñohttp://askani.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-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.
>
>


-- 
blog: http://www.debrice.com
project: http://alpha.kaaloo.com http://alpha.djangogenerator.com
linkedin: http://www.linkedin.com/in/bricepleroy

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



Cool and useful development commands :-)

2011-02-22 Thread Simone Federici
http://www.os4d.org/djangodevtools
Your feedback is very welcome

Simone

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



How to merge querysets and sort it?

2011-02-22 Thread Ryan Wijaya
For me it takes more than a week to solve it alone...
So to the point, is it possible to merge two querysets and sort it as
well?
Recently I've used itertools, but it returns a table with duplicated
value and requested objects not properly displayed (the get_full_name
displayed separately with other, creating a new row)


here's the codes
views.py

def view_siswa(request):
# list_detail.object_list, {"queryset": Data_Siswa.objects.all(),
"template_name": "views/view-siswa-list.html"}
namasiswa = User.objects.all().exclude(is_staff='false')
datasiswa = Data_Siswa.objects.all().order_by('kode_nis')
query = chain(datasiswa, namasiswa)
variables = RequestContext(request, {'siswa':query,})
# variables = RequestContext(request, {'siswa':datasiswa,})
return render_to_response(
'views/view-siswa-list.html',
# { 'siswa':namasiswa, 'datasiswa': datasiswa, }
variables,
)


template

{% for object in siswa %}

{{ object.username 
}}
{{ object.kode_nis }}
{{ object.first_name }}
{{ object.kode_jurusan }}
Lihat
Edit

{% endfor %}


Muchly appreciated any help... btw I'm new in Django

Regards

Rian

-- 
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 format django template code nicely with notepad++?

2011-02-22 Thread Bill Freeman
You *could* use Tidy, then post process with a sed script to convert
the '%20's to spaces.

There may be comparable Windows tool, but if you want sed, you can
install Cygwin.

But if you install Cygwin, you could edit with vim.

Since you're editing templates, you probably have python installed.
If there isn't already a python based template reformatter, that
sounds like an obvious project.  It would still be outside your
editor, however.  I really want formatting aid inside my editor
(spoiled emacs user).  Perhaps an extension to IDLE?

On Tue, Feb 22, 2011 at 9:55 AM, mongoose  wrote:
> hi all,
>
> I'm using notepad++ a lot and really missing a code formatter (vim
> would be = to format).
> Anyone know of anyway to format my html nicely? I've tried HTML Tidy
> but it keeps adding a 20% where I have a space for example
> "{{%20MEDIA_URL%20}}css/styles.css".
>
> --
> 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 format django template code nicely with notepad++?

2011-02-22 Thread Bill Freeman
And, certainly, replacing the %20 stuff is easy in python, should you
be happy with Tidy plus a post processing step.  There are probably
even suitable functions in the http or urllib libraries that will
catch more than the %20s.  You could even have the python tool run
Tidy for you, so that it looks like one step.

On Tue, Feb 22, 2011 at 10:20 AM, Bill Freeman  wrote:
> You *could* use Tidy, then post process with a sed script to convert
> the '%20's to spaces.
>
> There may be comparable Windows tool, but if you want sed, you can
> install Cygwin.
>
> But if you install Cygwin, you could edit with vim.
>
> Since you're editing templates, you probably have python installed.
> If there isn't already a python based template reformatter, that
> sounds like an obvious project.  It would still be outside your
> editor, however.  I really want formatting aid inside my editor
> (spoiled emacs user).  Perhaps an extension to IDLE?
>
> On Tue, Feb 22, 2011 at 9:55 AM, mongoose  wrote:
>> hi all,
>>
>> I'm using notepad++ a lot and really missing a code formatter (vim
>> would be = to format).
>> Anyone know of anyway to format my html nicely? I've tried HTML Tidy
>> but it keeps adding a 20% where I have a space for example
>> "{{%20MEDIA_URL%20}}css/styles.css".
>>
>> --
>> 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.



Problem using inheritance in third level: object has not attribute content_ptr_id

2011-02-22 Thread Ariel
Hi every body:
I have a problem making a hierarchy of objects in my project. For example I
have a class Thing in the first level that inherited from model, then I have
a class Content who inherites from Thing in the second level, another class
named Book inherited from Content.
The problem is that when I am going to save a Book object in the dango admin
backend then I get an error: "object has not attribute content_ptr_id" , I
don't understand why does this happen, when I save an object Content that
does not occur. I am using django 1.2.5 but when I try when dango 1.3 beta I
get the same error.
Could you help me please ???
How can I solve this error ???

Any help would be appreciate it.

Regards
Ariel

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



How to format django template code nicely with notepad++?

2011-02-22 Thread mongoose
hi all,

I'm using notepad++ a lot and really missing a code formatter (vim
would be = to format).
Anyone know of anyway to format my html nicely? I've tried HTML Tidy
but it keeps adding a 20% where I have a space for example
"{{%20MEDIA_URL%20}}css/styles.css".

-- 
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: Filtering List based on a custom dropdown

2011-02-22 Thread Andre Terra
Thank you, that looks great. I'll have a look at it later today.

Sincerely,
Andre Terra

On Tue, Feb 22, 2011 at 3:59 AM, Derek  wrote:

> On Feb 21, 4:22 am, Andre Terra  wrote:
> > I'd also like some input on this, as I'm reaching a point of my project
> > where I'll have to deal with a similar issue. I was planning on using
> ajax,
> > which actually means keeping it simple IMHO, but I would really like to
> > follow best practice.
> >
> > Should I make one query with a large subset of the data once and then
> just
> > filter it with jQuery? This seems to be the lighter approach in terms of
> DB
> > hits, but I'm not sure it's the right solution, specially considering I
> want
> > to be able to export the filtered data to a csv/xls format.
> >
> > Any ideas would be greatly appreciated, I'm really in the dark on this.
> >
> > Sincerely,
> > André Terra
> >
> > On Tue, Feb 8, 2011 at 9:15 PM, SimpleDimple  >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > can anyone help or point me to some simple django based app that I can
> > > study to understand more ?
> >
> > > On Feb 8, 2:07 am, SimpleDimple  wrote:
> > > > I can live w/o AJAX for now to keep it simple.
> >
> > > > What I am not clear is on how to do the postback from javascript ?  I
> > > > mean on what URL and pass on which variables ? and thru GET or POST
> or
> > > > shall i do form.submit()  ??
> >
> > > > On Feb 8, 1:45 am, Joel Goldstick  wrote:
> >
> > > > > On Mon, Feb 7, 2011 at 3:38 PM, SimpleDimple <
> > > farhandevelo...@gmail.com>wrote:
> >
> > > > > > I am new to django and building a school system but am experience
> > > > > > developer otherwise having firm grip over rails, php, .net and
> java.
> >
> > > > > > I have student table and in list I can see list of all students/
> > > > > > records in student table(pasted below is my code)
> >
> > > > > > what I want here is a custom dropdown listing the classes in
> school
> > > > > > from class table, and when you select/change the class the list
> of
> > > > > > students should get filtered accordinglycan someone please
> give
> > > me
> > > > > > hints or guide me a bit ?
> >
> > > > > > class StudentAdmin(admin.ModelAdmin):
> > > > > >fields= ['xclass', 'name', 'reg_no' , 'roll_no' ]
> > > > > >list_display  = ['xclass', 'name', 'reg_no' , 'roll_no' ]
> > > > > >list_filter   = ['name', 'reg_no' , 'roll_no' ]
> > > > > >search_fields = ['name', 'reg_no' , 'roll_no' ]
> >
> > > > > >form  =  StudentForm
> >
> > > > > >def queryset(self, request):
> > > > > >school_id = request.session['school_id']
> > > > > >qs = self.model._default_manager.filter(school=school_id)
> > > > > >return qs
> >
> > > > > >def save_model(self, request, obj, form, change):
> > > > > >school_id = request.session['school_id']
> > > > > >school = School.objects.get(id=school_id)
> > > > > >obj.school = school
> > > > > >obj.save()
> >
> > > > > > --
> > > > > > 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.
> >
> > > > > This topic has come up recently under different specifics.  When
> you
> > > change
> > > > > your filter (by selecting a specific class) you need to requery
> with
> > > that
> > > > > condition.  This can be done by submitting the form to get a new
> > > dataset, or
> > > > > by using AJAX style to have the data retrieved on the fly to
> repopulate
> > > your
> > > > > form.
> >
> > > > > --
> > > > > Joel Goldstick
>
> There is a very detailed set of code examples here:
>
> http://stackoverflow.com/questions/1671446/country-state-city-dropdown-menus-inside-the-django-admin-inline
>
> --
> 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: I'm having problem showing from the value a sub-sub model.

2011-02-22 Thread Chris
sorry your right, I didn't receive any notification so I thought it
wasn't posted.
I've answered in the original thread

On Feb 21, 2:00 pm, Shawn Milochik  wrote:
> Why are you re-posting this? You posted it over the weekend. I
> replied. If my reply didn't help, tell us the new problem you're
> having.

-- 
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: TemplateDoesNotExist error when running tests in django.contrib.sitemaps.tests.basic.SitemapTests

2011-02-22 Thread Karen Tracey
On Tue, Feb 22, 2011 at 4:18 AM, sajal  wrote:

> Installing django from the svn trunk no more fails the tests. Perhaps
> the archives should not be skipping these files?
>

This problem was reported in the bug tracker and has already been fixed:

http://code.djangoproject.com/ticket/14990

Can't fix the existing packages where the files are missing, but subsequent
ones will include them.

Karen
-- 
http://tracey.org/kmt/

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



What's happen when using threadlocals with Apache/mod_wsgi?

2011-02-22 Thread Alisue
Hi, I have a question to using threadlocals trick on Apache/mod_wsgi.

I built some SMS using threadlocals trick and FAILED. I was filtering
blog post with current user, and blog post has publish policy like
"public"(everyone can see) and "grouped"(user who joined in the group
which author joined in can see). Everything was fine on development
but deploy. User RANDOMLY can see the post which he/see should be able
to see.

what I wrote was like below:

-
# middleware/threadlocals.py
from django.utils.thread_support import currentThread
_requests = {}
def get_request():
if currentThread() in _request:
return _requests[currentThread()]
return None
# Middleware which set request to _requests[currentThread]
# ...

# blogs/models.py
class EntryManager(models.Manager):
def published(self):
user = threadlocals.get_request().user
return self.filter(author=user)
class Entry(models.Model):
author = models.ForeignKey(User)
-

the threadlocals is copied from some snippets (i forgot which) so i
wasn't sure what's happen. now
i notice that this threadlocals trick required that Django process has
to be unique for each request (to make sure currentThread is unique
for each request in the process) isn't it?

So I wonder that is Apache/mod_wsgi create new Django process for each
request? If so why the code above didn't work proper? and why a lot's
of people disagree with `threadlocals` trick even Django
(django.db.transaction.py) and django-cms (middleware/user.py) using
similar trick?

sorry for my ugly English, thank you for reading.

P.S.

Actually I solved this problem with writing whole custom db.model,
forms, generic view which pass `request` to the db.model.save, clean,
delete method. However now i wonder how can i change a template
loading directory depend on request (for PC, iPhone, mobile...) and
using django-cms. so i wonder is there any special settings for
mod_wsgi to using threadlocals trick or whatever. any idea is welcome.

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



Announce: Django REST framework

2011-02-22 Thread tom christie
Hey all,

  I'm superpleased to announce the release of Django REST framework 0.1.
http://django-rest-framework.org/

  The project is another mini-framework aimed at making it easy to
build well-connected, self-describing RESTful web APIs,
in the same vein as django-piston and django-tastypie.  (There's even a bit
of piston code in there too)

Some of the stand out features:

   - The APIs that it creates are automatically browseable via the awesome
   admin-styled interface, allowing them to be self documenting, and allowing
   you to read, create, update and delete resources via the browser. Eg:
   http://api.djangorestframework.org/
   -  The framework uses Django's new class based views, with the various
   functionality separated into MixIn classes, making it really flexible - you
   can use parts of the framework in your own View classes, even if you don't
   use the core Resource and ModelResource classes it provides.
   - Nice simple Resource and ModelResource classes, with default handler
   methods on the ModelResource class and automatic input validation using
   ModelForms.
   - And a whole bunch of stuff really...

Creating new resources can be as simple as adding a couple of lines to your
URLconf...

from django.conf.urls.defaults import patterns, url
from djangorestframework import ModelResource, RootModelResource
from models import MyModel

urlpatterns = patterns('',
url(r'^$', RootModelResource.as_view(model=MyModel)),
url(r'^(?P[^/]+)/$', ModelResource.as_view(model=MyModel),
name='my-model'),
)

(For anything beyond that head on over to the docs...)

Thoughts or feedback always appreciated.

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: Django Form Validation

2011-02-22 Thread ju
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.



Handling readonly fields in the admin, which are provided by the form

2011-02-22 Thread Viktor Kojouharov
Hello,

I'm having a bit of a problem providing a custom readonly field, which is 
defined in the form.
The field is defined in the form, as such:
class Form(forms.modelForm):
  field = myCustomField()

The field is also associated with a custom widget, which is set in the 
form's __init__.

it is included in a fieldset with its name - 'field', and under normal 
circumstances is writable. This works just fine.
However, if I add this field to the self.readonly_fields list in the 
modelAdmin's change_view, django complains that it cannot find it anymore.

After a lot of debugging, I worked around that by defining a method in the 
modelAdmin:
def fields(self, instance):
form = self.form(instance=instance)
widget = form.fields['field'].widget
widget.is_readonly = True
value = instance.some_field
return widget.render('field', value)

field.short_description = _('Lookup')
field.allow_tags = True

While this works, I don't feel it is the correct approach. I didn't even 
find any documentation on it, and I have to instantiate the form again, just 
to get the field's widget, plus I also have to construct the value again.

Is there a better way to achieve this? How can I get that the field is 
read-only from the widget itself?

-- 
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 way to deploy a project with custom compiled python 2.7 & virtualdev

2011-02-22 Thread Benedict Verheyen
On 21/02/2011 9:57, Benedict Verheyen wrote:
> Hi,
> 
> 
> i have a Django project in a virtualdev.
> Because it was developed before Debian squeeze, i wanted a recent version of 
> python
> and compiled my own 2.7 version, then installed that in my virtual dev.
> 
> Now for deploying to the production server, i had following scenario in mind:
> - install programs and database that my programs needs (postgresql and so on)
> - get my project on the server via svn
> - install virtualdev, and install the requirements i got via the freeze 
> command on the dev server.
> - fix paths in Apache, Nginx
> 
> However, here i have a problem. To make the virtualdev environment, i need to 
> python version 2.7
> and that's not available on the server.
> The compiled version is available on the dev server.
> What's the  most elegant solution?
> 
> Copy the whole virtual environment to the server?
> Make a package of the python install?
> 
> Thanks for any insight,
> Benedict
> 

Hi,


thanks for the info. I was hoping that i could avoid compiling python on the 
dev server
as it's also a Debian Squeeze. Maybe i can make a package from it using 
checkinstall.
As for Shawn's suggestions, I already use option 2 on my dev server.

Cheers,
Benedict

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



TemplateDoesNotExist error when running tests in django.contrib.sitemaps.tests.basic.SitemapTests

2011-02-22 Thread sajal
when running python manage.py test i get the following output :-

http://pastie.org/1592973

I am using django 1.3 beta 1 (the problem also occurred in alpha)

Basically it complains about a missing file: custom_sitemap.xml

After investigating, i realized that all the packaged archives from
http://www.djangoproject.com/download/ miss the directory
http://www.djangoproject.com/download/templates/ . that directory is
present in the svn version.  -
http://code.djangoproject.com/browser/django/trunk/django/contrib/sitemaps/tests/templates
<-- that directory is missing from the downloadable .tar.gz files.

Installing django from the svn trunk no more fails the tests. Perhaps
the archives should not be skipping these files?

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