Authorization of static content

2011-02-23 Thread Joakim Hove
Hello,

I am using Django to create an album application. I was planning to
use djangos user system for authorization, however the final image
viewing will be like:

 

Where image.url should resolve to something like 
http://static-images.com/path/to/image.jpg

Here http://static-images.com is another apache virtual host which
only serves static content. However this scheme fails miserably when
it comes to authorization - anyone can completely bypass my django app
(with authorization) and point their browser to:

http://static-images.com/path/to/image.jpg

Any suggestions of how to combine django based authorization with
serving of static content? I am the owner of the box in question and
can modify the apache setup way beyond my competence.

Regards - Joakim Hove

-- 
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 in returning the value.

2011-02-23 Thread cuteangel
this is the class from models.py-
class NatPar(models.Model):
@staticmethod
def handle_review(self):
try:
grammar=nltk.parse_cfg("""
S->VP NP
PP->P N
NP->Det N PP
VP->V Det
Det ->'me'|'the'
N->'review'|'DON'
V->'Give'
P->'of'
""")
sent=['Give','me','the','review','of','DON']
parser=nltk.ChartParser(grammar)
trees=parser.nbest_parse(sent)
for tree in trees:
print tree
tokens=find_all_NP(tree)
print tokens
return tokens
except:
return None



def find_all_NP(tree):
if  type(tree)==type('string'):
return None

if tree.node=='NP':
return '-'.join(tree.leaves())

return [npstr for npstr in [find_all_NP(node) for node in
tree[0:]] if npstr]


and calling function is like this-

response=NatPar.handle_review

return render_to_response('review1.html',
{'response':response})

and its displays template like this--



 so what's the problem in handle review..I already checked
the code on python shell n its working there.

-- 
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: Authorization of static content

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 12:03:12 am Joakim Hove wrote:
> Hello,
 
> Any suggestions of how to combine django based authorization with
> serving of static content? I am the owner of the box in question and
> can modify the apache setup way beyond my competence.
> 
> Regards - Joakim Hove

You might want to look into this[1] for the http basic authentication.  I 
personally haven't used http basic auth with django, yet.  But the page looks 
to be a good starting pont.
 

Mike

[1] http://stackoverflow.com/questions/152248/can-i-use-http-basic-
authentication-with-django
-- 
My opinions may have changed, but not the fact that I am right.

-- 
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 in returning the value.

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 12:10:14 am cuteangel wrote:
> this is the class from models.py-
> class NatPar(models.Model):
> @staticmethod
> def handle_review(self):
> try:
> grammar=nltk.parse_cfg("""
> S->VP NP
> PP->P N
> NP->Det N PP
> VP->V Det
> Det ->'me'|'the'
> N->'review'|'DON'
> V->'Give'
> P->'of'
> """)
> sent=['Give','me','the','review','of','DON']
> parser=nltk.ChartParser(grammar)
> trees=parser.nbest_parse(sent)
> for tree in trees:
> print tree
> tokens=find_all_NP(tree)
> print tokens
> return tokens
> except:
> return None
> 
> 
> 
> def find_all_NP(tree):
> if  type(tree)==type('string'):
> return None
> 
> if tree.node=='NP':
> return '-'.join(tree.leaves())
> 
> return [npstr for npstr in [find_all_NP(node) for node in
> tree[0:]] if npstr]
> 
> 
> and calling function is like this-
> 
> response=NatPar.handle_review
> 
> return render_to_response('review1.html',
> {'response':response})
> 
> and its displays template like this--
> 
> 
> 
>  so what's the problem in handle review..I already checked
> the code on python shell n its working there.

try: response=NetPar.handle_review() 

What you're seeing a the function location in memory and not calling it to get 
the returned value.

Mike

-- 
Man's reach must exceed his grasp, for why else the heavens?

-- 
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: Authorization of static content

2011-02-23 Thread Joakim Hove
Thank you;

that was a very good starting point - I will hopefully find a solution
from this.

Joakim

On 23 Feb, 09:18, Mike Ramirez  wrote:
> On Wednesday, February 23, 2011 12:03:12 am Joakim Hove wrote:
>
> > Hello,
> > Any suggestions of how to combine django based authorization with
> > serving of static content? I am the owner of the box in question and
> > can modify the apache setup way beyond my competence.
>
> > Regards - Joakim Hove
>
> You might want to look into this[1] for the http basic authentication.  I
> personally haven't used http basic auth with django, yet.  But the page looks
> to be a good starting pont.
>
> Mike
>
> [1]http://stackoverflow.com/questions/152248/can-i-use-http-basic-
> authentication-with-django
> --
> My opinions may have changed, but not the fact that I am right.

-- 
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: Authorization of static content

2011-02-23 Thread Sam Lai
On 23 February 2011 19:03, Joakim Hove  wrote:
> Hello,
>
> I am using Django to create an album application. I was planning to
> use djangos user system for authorization, however the final image
> viewing will be like:
>
>     
>
> Where image.url should resolve to something like 
> http://static-images.com/path/to/image.jpg
>
> Here http://static-images.com is another apache virtual host which
> only serves static content. However this scheme fails miserably when
> it comes to authorization - anyone can completely bypass my django app
> (with authorization) and point their browser to:
>
>    http://static-images.com/path/to/image.jpg
>
> Any suggestions of how to combine django based authorization with
> serving of static content? I am the owner of the box in question and
> can modify the apache setup way beyond my competence.

An alternate solution is to use Django to perform the authorization,
but pass the serving of the image file to the web server. This
question has come up before, so here's a link to the previous thread -

http://groups.google.com/group/django-users/browse_thread/thread/3216b31b8a03f1ca?pli=1

> Regards - Joakim Hove
>
> --
> 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: [] database i18n

2011-02-23 Thread Henrik Genssen
I feel, this should be something integrated into Django, too.

So far I am using transdb (but I am still sitting on Django 1.1).

advantage:
- all translations in one field as a dict so easy searchable, if icontains is 
all you want

disadvantages:
- all translations in one field as a dict, therefor finds other rows having a 
similar phrase (in other languages), too, as you must use icontains
- you can not use startswith or endswith
- no support for django-tagging

regards

Henrik

>reply to message:
>date: 22.02.2011 13:13:18
>from: "Federico Capoano" 
>to: "Django users" 
>subject: [] database i18n
>
>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.
>

-- 
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 formfield submit

2011-02-23 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I have a form that - of course - creates new entry in my database. 

I created the form out of a model except for 1 field. 

 

Now if i click submit only the values of the fields that are created out
of the form are stored in the DB - also not suprising

What i want to to is take the value of the custom field and add it to
the value of one of the fields that where generated from the model. 

 

How do i do that ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





-- 
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-23 Thread Tom Evans
On Tue, Feb 22, 2011 at 9:42 PM,   wrote:
> 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.
>

It takes about a month to get up to speed with vim, about a year to
become proficient and about three years to be fully comfortable. The
longer you use vim, the faster you get using it, and the more
productive you can be compared to users using mouse driven GUIs.
If you intend making a living out of knocking out 1's and 0's in a
specific order, it's wise to become fully acquainted with an editor
that is powerful and concise to use, and then never use anything but
that editor*.

>From The Pragmatic Programmer [1]:

Use a Single Editor Well
The editor should be an extension of your hand; make sure your editor
is configurable, extensible, and programmable.

Cheers

Tom

[1] http://pragprog.com/the-pragmatic-programmer/extracts/tips

* It doesn't need to be vim, I also accept emacs.

-- 
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-23 Thread Simone Federici
Thanks!
I want improve some commands,

for example I'd like have a feedback on the monkey patch on fetch_command
for coverage command. What you think? It is usefull for use a command before
it load the applications and before the model validation.

thanks
Simone



On Tue, Feb 22, 2011 at 19:05, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

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



Re: Cool and useful development commands :-)

2011-02-23 Thread Mike Ramirez
On Tuesday, February 22, 2011 08:46:34 am Simone Federici wrote:
> http://www.os4d.org/djangodevtools
> Your feedback is very welcome
> 
> Simone

Doesn't xsyncdb mimic the way syncdb already works or is there some difference 
that isn't apparent from the description?


Also, why not GZip instead of Zip for xloaddata, or are you planning to add 
the support for gzip/bzip later?  (I don't really think of zip as a 
compression tool as much as an archiving tool similar to tar, though I know 
zip supports compression).

and how does xshell differentiate from shell if you have ipython installed 
already?


These are the main questions I have glancing over them. But great work.

Mike 

-- 
Oh wearisome condition of humanity!
Born under one law, to another bound.
-- Fulke Greville, Lord Brooke

-- 
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-23 Thread Mike Ramirez
On Tuesday, February 22, 2011 08:46:34 am Simone Federici wrote:
> http://www.os4d.org/djangodevtools
> Your feedback is very welcome
> 
> Simone

Also, this just hit me as I hit send, but what do you think of adding 
something that helps scan templates for obvious XSS mistakes as per this 
request/thread[1] a few days ago

Mike

[1] http://groups.google.com/group/django-
users/browse_thread/thread/58f95c18aaa678f7/ffb840be1fb4cc81
-- 
Each new user of a new system uncovers a new class of bugs.
-- Kernighan

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

2011-02-23 Thread Federico Capoano
Thanks Hernik. I liked the idea of django-i18n-model but I couldn't
get it working. Now I'm about to try django-transmeta.


On Feb 23, 10:34 am, "Henrik Genssen" 
wrote:
> I feel, this should be something integrated into Django, too.
>
> So far I am using transdb (but I am still sitting on Django 1.1).
>
> advantage:
> - all translations in one field as a dict so easy searchable, if icontains is 
> all you want
>
> disadvantages:
> - all translations in one field as a dict, therefor finds other rows having a 
> similar phrase (in other languages), too, as you must use icontains
> - you can not use startswith or endswith
> - no support for django-tagging
>
> regards
>
> Henrik
>
>
>
>
>
>
>
> >reply to message:
> >date: 22.02.2011 13:13:18
> >from: "Federico Capoano" 
> >to: "Django users" 
> >subject: [] database i18n
>
> >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 
> >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.



How to skip some translation in trans block?

2011-02-23 Thread galago
I need to skip translating some content from the string in template.
I want to make something like this:

I pass the tag variable to the temaplte. Then I want to make a string: Tag: 
tag_variable. I need it to be in trans block, but only first word (Tag) must 
be translated. In other words - I need to skip translating the variable 
content and do translation only to string given directly in '..'

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

2011-02-23 Thread Kenneth Gonsalves
On Wed, 2011-02-23 at 02:21 -0800, Federico Capoano wrote:
> Thanks Hernik. I liked the idea of django-i18n-model but I couldn't
> get it working. Now I'm about to try django-transmeta.
> 
> 

django-transmeta rocks bigtime, especially if you have an unknown set of
languages.
-- 
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: How to skip some translation in trans block?

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 02:22:47 am galago wrote:
> I need to skip translating some content from the string in template.
> I want to make something like this:
> 
> I pass the tag variable to the temaplte. Then I want to make a string: Tag:
> tag_variable. I need it to be in trans block, but only first word (Tag)
> must be translated. In other words - I need to skip translating the
> variable content and do translation only to string given directly in '..'

...
{% comment %}
end the current trans block to handle special case
{% endcomment %}
{% endblocktrans %}
(% trans Tag: %} {{ myvar }}
{% comment %}
start trans block  again
{% endcomment %}
{% blocktrans %}


or (wrap with the same blocktrans/endblocktrans as above)

{% if myvar %}
{% trans Tag: %} {{ myvar }}
{% else %}
{% blocktrans %}
Tag: ..
{% endblock %}
{% endif %}

Neither of these forms fit your needs? 

Mike



-- 
/* we have tried to make this normal case as abnormal as possible */
 -- Larry Wall in cmd.c from the perl source code

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



scripted login to django

2011-02-23 Thread Robin Becker
I want to automate a remote django view which requires a login with a python 
script, but I am having difficulty in deciding how to make django accept the 
various cookies. Is there example code somewhere which shows how this should be 
done?


I've tried various cookie jar based approaches, but they don't seem to work. The 
test client works through the server code rather than through the web.

--
Robin Becker

--
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-23 Thread Simone Federici
Oh yes actually xsyncdb is just the syncdb taken from 1.3alpha. I'm
developing with 1.2.5 but try to take the good stuff from the trunk and in
1.3 is possible use an hidden  load_initial_data paramenter :-)

xloaddata is a more verbosing loaddata,often, in developing, some changes
may send wrong the fixtures. xloaddata tell you which is last good fixture
loaded before the erroe. (is just a print of obj)

xshell instead is a shortcut that load automatically all models of your
applications. With xshell you don't need to import from the shell your
models.

For the utility "scan templates" for obvious XSS mistakes,
it colud be a good tool, but I need your help to add this feature. I have
before to understand what you intend for obvious.

Thanks for your feedback

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

>  On Tuesday, February 22, 2011 08:46:34 am Simone Federici wrote:
>
> > http://www.os4d.org/djangodevtools
>
> > Your feedback is very welcome
>
> >
>
> > Simone
>
> Doesn't xsyncdb mimic the way syncdb already works or is there some
> difference that isn't apparent from the description?
>
>  Also, why not GZip instead of Zip for xloaddata, or are you planning to
> add the support for gzip/bzip later? (I don't really think of zip as a
> compression tool as much as an archiving tool similar to tar, though I know
> zip supports compression).
>
> and how does xshell differentiate from shell if you have ipython installed
> already?
>
>  These are the main questions I have glancing over them. But great work.
>
> Mike
>

-- 
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: scripted login to django

2011-02-23 Thread Simone Dalla
2011/2/23 Robin Becker 

> I want to automate a remote django view which requires a login with a
> python script, but I am having difficulty in deciding how to make django
> accept the various cookies. Is there example code somewhere which shows how
> this should be done?
>
> I've tried various cookie jar based approaches, but they don't seem to
> work. The test client works through the server code rather than through the
> web.
> --
> Robin Becker
>
>
http://twill.idyll.org/

-- 
Simo

- Registered Linux User #395060

- Software is like sex, it is better when it is free  --> Linus B. Torvalds

-- 
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: scripted login to django

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 03:28:31 am Robin Becker wrote:
> I want to automate a remote django view which requires a login with a
> python script, but I am having difficulty in deciding how to make django
> accept the various cookies. Is there example code somewhere which shows
> how this should be done?
> 
> I've tried various cookie jar based approaches, but they don't seem to
> work. The test client works through the server code rather than through
> the web.


Have your tried urllib2.Request[1] to POST your login data, how a browser 
would do it?  

something like this:

Assuming login form:

class LoginForm(forms.Form):
username = forms.CharField()
   password = forms.CharField()


# your client script

post_data = {
'username': 'me',
   'password': 'pass',
}

data = urllib.urlencode(post_data)

# sends data as a POST[2]
req = urllib2.Request(url='http://mydomain.tld/login', data=data)

resp = urllib1.urlopen(req)


[2] from the link below about the data parameter: Currently HTTP requests are 
the only ones that use data; the HTTP request will be a POST instead of a GET 
when the data parameter is provided. 


Please note this is untested code. You might also want to see the urllib2 
missing manual[3]

Mike


[1] http://docs.python.org/library/urllib2.html#urllib2.Request
[3] http://www.voidspace.org.uk/python/articles/urllib2.shtml
-- 
The course of true anything never does run smooth.
-- Samuel Butler

-- 
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 in returning the value.

2011-02-23 Thread Daniel Roseman
On Wednesday, February 23, 2011 9:10:14 AM UTC+1, cuteangel wrote:
>
> this is the class from models.py- 
> class NatPar(models.Model): 
> @staticmethod 
> def handle_review(self): 
>
 

> 
>
 

> and calling function is like this- 
>
> response=NatPar.handle_review 
>
> return render_to_response('review1.html', 
> {'response':response}) 
>
> and its displays template like this-- 
>
>  
>
>  so what's the problem in handle review..I already checked 
> the code on python shell n its working there.


As Mike points out, you're not actually calling the function.

However, when you do, you'll have another problem. Staticmethods don't take 
the `self` parameter, so you'll need to remove that.
--
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.



how to declare a list in django models.py class

2011-02-23 Thread cuteangel
how to declare a list in django models.py class

-- 
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 the difference between MEDIA_ROOT and STATIC_ROOT?

2011-02-23 Thread King
In the Note under this section
http://docs.djangoproject.com/en/dev/howto/static-files/#s-using-django-contrib-staticfiles
, it mentions that "In previous versions of Django, it was common to
place static assets in MEDIA_ROOT along with user-uploaded files, and
serve them both at MEDIA_URL. " and that "staticfiles does not deal
with user-uploaded files at all."

Does this mean that you use STATIC_ROOT for all your static files
(CSS, JS, images), and MEDIA_ROOT just for user-uploaded files?

It's confusing because in the Django code I've looked at, I've only
seen people use the MEDIA_ROOT, and it's often used to store the CSS,
JS and Images (the same files that the documentation seems to be
suggesting that STATIC_ROOT should be used for).

-- 
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: Collaborative text editor with Django

2011-02-23 Thread Anoop Thomas Mathew
Hi,

Is there any collaborative text editing application available for django.
Has anybody tried with etherpad(www.etherpad.org) along with django?

Please reply,
Thanks in advance,
Anoop

atm
___
Life is short, Live it hard.

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



Where can I find the admin/base_site.html

2011-02-23 Thread DJ Chung
I am going through the tutorial on Djangoproject.com.  I'm trying to
work on templates and I don't know where to find admin/base_site.html

Where's the actual code I can copy and paste?

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



Admin-enabled glossary

2011-02-23 Thread yuri2k
I need to find a way to use a glossary (sort of like
https://github.com/kcunning/django-glossary) but that can be called
when you insert a new entry elsewhere on the data structure (i.e., any
page with text). The ideal would be to use a tag system to make this
insertion simple, but ultimately, an html link with a specific class
will do. The objective is to then have them displayed on the front end
as tooltips or something similar. Any clues appreciated.

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



Using constants for named URLs

2011-02-23 Thread zvikico
Hello,

When defining URLs, I prefer named URLs. I like to define these names as 
constants, so I can use the contants in other files. Probably an 
old habit from my days as a Java developer, but I still think it is better 
than using the string all over the place. Here's an example:

URL_USER_REGISTER = 'user-register'
URL_USER_ACCOUNT = 'user-account'

urlpatterns = patterns('',
   url(r'^register/$', views.register, name = URL_USER_REGISTER),
   url(r'^accounts/$', views.account, name = URL_USER_ACCOUNT),
)

Then, I can use urls. URL_USER_ACCOUNT for redirecting in my view code. 

Note that I'm using the view function directly in the url() function, rather 
than specifying a view name. That's because I like the extra layer of error 
checking: a missing view function can easily be detected by my IDE.

The problem: I'm getting a circular import here. I cannot import the urls 
from the views and the views from the urls. 
Considering that I want to keep the above two practices (constants and 
passing view functions), is there a solution for that?
I can take the constants to a separate module, but that seems like an 
overkill. Any suggestions?

Thanks,
Zviki




-- 
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: Where can I find the admin/base_site.html

2011-02-23 Thread Marcos Moyano
It depends on what you are using. For me is
/usr/lib/python2.7/site-packages/django/contrib/admin/templates/admin/

Hope it helps.

On Wed, Feb 23, 2011 at 6:06 AM, DJ Chung  wrote:

> I am going through the tutorial on Djangoproject.com.  I'm trying to
> work on templates and I don't know where to find admin/base_site.html
>
> Where's the actual code I can copy and paste?
>
> --
> 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.
>
>


-- 
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

-- 
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: Collaborative text editor with Django

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 12:32:55 am Anoop Thomas Mathew wrote:
> Hi,
> 
> Is there any collaborative text editing application available for django.
> Has anybody tried with etherpad(www.etherpad.org) along with django?
> 
> Please reply,
> Thanks in advance,
> Anoop
> 
> atm
> ___
> Life is short, Live it hard.

I like eric5 for this, it's python 3.x though. But great collabrotive tools 
involved, including a chat server and issue tracker. 

Gobby is another, but his is more general purpose than coding.


I've also seen screen + [vi|emacs|nano] for collaboritve coding on the server 
side.


As for etherpad nope, never have bothered, never heard of it till now ftr.

Mike

-- 
  A little pain never hurt anyone.

-- 
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: Where can I find the admin/base_site.html

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 01:06:40 am DJ Chung wrote:
> I am going through the tutorial on Djangoproject.com.  I'm trying to
> work on templates and I don't know where to find admin/base_site.html
> 
> Where's the actual code I can copy and paste?

http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templates/admin/base_site.html


anything with admin is in django/contrib/admin 

except admindocs which are django/contrib/admindocs 

Mike

-- 
This fortune does not require Microsoft Windows. 

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



Override model field

2011-02-23 Thread Pascal Polleunus

Hi,

I've a field with unique=True in a parent class.
I want to make it unique=False in a child class.
How could I do that?

Thanks,
Pascal

--
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: What's the difference between MEDIA_ROOT and STATIC_ROOT?

2011-02-23 Thread Xavier Ordoquy
Hi,

As the documentation said, in the previous version, it was common to place both 
in the MEDIA_ROOT (unless you used 3rd party application to avoid that).
So as long as the code has not been ported to 1.3, you'll probably see that 
again and often.

Regards,
Xavier.

Le 23 févr. 2011 à 08:04, King a écrit :

> In the Note under this section
> http://docs.djangoproject.com/en/dev/howto/static-files/#s-using-django-contrib-staticfiles
> , it mentions that "In previous versions of Django, it was common to
> place static assets in MEDIA_ROOT along with user-uploaded files, and
> serve them both at MEDIA_URL. " and that "staticfiles does not deal
> with user-uploaded files at all."
> 
> Does this mean that you use STATIC_ROOT for all your static files
> (CSS, JS, images), and MEDIA_ROOT just for user-uploaded files?
> 
> It's confusing because in the Django code I've looked at, I've only
> seen people use the MEDIA_ROOT, and it's often used to store the CSS,
> JS and Images (the same files that the documentation seems to be
> suggesting that STATIC_ROOT should be used for).
> 
> -- 
> 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.



Querysets: returning a single item with the greatest id.

2011-02-23 Thread Sithembewena Lloyd Dube
Hi everyone,

How would one fetch a single item with the largest id (or most recent date
of creation) via the database API?

-- 
Regards,
Sithembewena Lloyd Dube

-- 
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: scripted login to django

2011-02-23 Thread Robin Becker

On 23/02/2011 11:51, Mike Ramirez wrote:
...



Have your tried urllib2.Request[1] to POST your login data, how a browser
would do it?



yes
...

eventually I got this to work with 1.2.5 (and the tutorial site); the main 
problems were that hitting admin to get the csrfmiddlewaretoken pops up a login 
page which posts back to /admin/ (not /admin/login/); also it seems we need to 
add in the extra hidden variable this_is_the_login_form to make things work better.



import urllib2, urllib, cookielib

site='http://127.0.0.1:8000'
cj = cookielib.CookieJar()

# build opener with HTTPCookieProcessor
o = urllib2.build_opener( urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener( o )


print 1, 30*'='
for cookie in cj:
print cookie.domain, cookie.path, cookie.name, cookie.value
# perform login with params
f = o.open( site + '/admin/')
data = f.read()
f.close()
print 1,30*'!'
print data
D={ 'username': 'myuser', 'password': 'mypassword', 'this_is_the_login_form': 
'1'}
tl = [l for l in data.split('\n') if 'csrfmiddlewaretoken' in l]
if not tl:
raise ValueError('no csrf token found')
tl = tl[0].split('value=')
tl = tl[1].split(' ')[0].strip('"\'')
D['csrfmiddlewaretoken'] = tl
p = urllib.urlencode(D)

print 2, 30*'='
for cookie in cj:
print cookie.domain, cookie.path, cookie.name, cookie.value

f = o.open( site + '/admin/',p)
data = f.read()
f.close()
print 2,30*'!'
print data

# second request should automatically pass back any
# cookies received during login... thanks to the HTTPCookieProcessor
print 3, 30*'='
for cookie in cj:
print cookie.domain, cookie.path, cookie.name, cookie.value

f = o.open( site+'/admin/')
data = f.read()
f.close()
print 3,30*'!'
print data




--
Robin Becker

--
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: What's the difference between MEDIA_ROOT and STATIC_ROOT?

2011-02-23 Thread Mike Ramirez
On Tuesday, February 22, 2011 11:04:52 pm King wrote:
> In the Note under this section
> http://docs.djangoproject.com/en/dev/howto/static-files/#s-using-django-con
> trib-staticfiles , it mentions that "In previous versions of Django, it was
> common to place static assets in MEDIA_ROOT along with user-uploaded
> files, and serve them both at MEDIA_URL. " and that "staticfiles does not
> deal with user-uploaded files at all."
> 
> Does this mean that you use STATIC_ROOT for all your static files
> (CSS, JS, images), and MEDIA_ROOT just for user-uploaded files?
> 
> It's confusing because in the Django code I've looked at, I've only
> seen people use the MEDIA_ROOT, and it's often used to store the CSS,
> JS and Images (the same files that the documentation seems to be
> suggesting that STATIC_ROOT should be used for).

Static files appear to be for apps as part of large projects. 

from the docs[1]:
For small projects, this isn’t a big deal, because you can just keep the 
static files somewhere your web server can find it. However, in bigger projects 
– especially those comprised of multiple apps – dealing with the multiple sets 
of static files provided by each application starts to get tricky. 


also from settings.py

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

Essentially, I think this is a "You'll know when you need it." type setting.

Mike

[1] http://docs.djangoproject.com/en/dev/howto/static-files/
-- 
When some people discover the truth, they just can't understand why
everybody isn't eager to hear it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Querysets: returning a single item with the greatest id.

2011-02-23 Thread Tom Evans
On Wed, Feb 23, 2011 at 12:57 PM, Sithembewena Lloyd Dube
 wrote:
> Hi everyone,
>
> How would one fetch a single item with the largest id (or most recent date
> of creation) via the database API?
>
> --
> Regards,
> Sithembewena Lloyd Dube
>

Foo.objects.all().order_by('-pk')[0] ?

Cheers

Tom

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



Re: Querysets: returning a single item with the greatest id.

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 05:04:29 am Tom Evans wrote:
> On Wed, Feb 23, 2011 at 12:57 PM, Sithembewena Lloyd Dube
> 
>  wrote:
> > Hi everyone,
> > 
> > How would one fetch a single item with the largest id (or most recent
> > date of creation) via the database API?
> > 
> > --
> > Regards,
> > Sithembewena Lloyd Dube
> 
> Foo.objects.all().order_by('-pk')[0] ?
> 
> Cheers
> 
> Tom

also latest()[0] 

Mike

 
http://docs.djangoproject.com/en/1.2/ref/models/querysets/#django.db.models.QuerySet.latest
-- 
Bershere's Formula for Failure:
There are only two kinds of people who fail: those who
listen to nobody... and those who listen to everybody.

-- 
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: Querysets: returning a single item with the greatest id.

2011-02-23 Thread Sithembewena Lloyd Dube
@Tom, thanks. I thought of ordering the QuerySet, but I was not sure whether
that would default to ASC or DESC - and I was not sure how to pass
parameters to influence this.

@Mike, thanks. That looks simpler to do.

On Wed, Feb 23, 2011 at 3:08 PM, Mike Ramirez  wrote:

>  On Wednesday, February 23, 2011 05:04:29 am Tom Evans wrote:
>
> > On Wed, Feb 23, 2011 at 12:57 PM, Sithembewena Lloyd Dube
>
> >
>
> >  wrote:
>
> > > Hi everyone,
>
> > >
>
> > > How would one fetch a single item with the largest id (or most recent
>
> > > date of creation) via the database API?
>
> > >
>
> > > --
>
> > > Regards,
>
> > > Sithembewena Lloyd Dube
>
> >
>
> > Foo.objects.all().order_by('-pk')[0] ?
>
> >
>
> > Cheers
>
> >
>
> > Tom
>
> also latest()[0]
>
> Mike
>
>
> http://docs.djangoproject.com/en/1.2/ref/models/querysets/#django.db.models.QuerySet.latest
>
> --
>
> Bershere's Formula for Failure:
>
> There are only two kinds of people who fail: those who
>
> listen to nobody... and those who listen to everybody.
>
>  --
> 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.
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
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-23 Thread Simone Federici
Maybe you could write a filter "urlsafe" to use into templates so that
variable does not contains javascript.
And you could create a command that scan templates and raise an alert every
variable inside an href attribute that is not "urlsafe".

But I believe that a tool is used to work, not to do the work for me. And
Django is a tool.
It's like the java paradox,  java is a language that hidden a lot of
problems, and try to resolve them without the programmers. Result: you
cannot trust a java programmer, because often he doesn't know what the code
really does.

For this reason, I see that this kind of problems are better if you leave
resolve by developers. The better solution is to document better the
problem.

I think it is out of the scope of djangodevtools.
In other words, djangodevtools not is a library to development, but is a
library to help the development process itself.


On Wed, Feb 23, 2011 at 13:15, Mike Ramirez  wrote:

>  On Wednesday, February 23, 2011 03:36:32 am you wrote:
>
> > Oh yes actually xsyncdb is just the syncdb taken from 1.3alpha. I'm
>
> > developing with 1.2.5 but try to take the good stuff from the trunk and
> in
>
> > 1.3 is possible use an hidden load_initial_data paramenter :-)
>
> >
>
> Cool.
>
>  > xloaddata is a more verbosing loaddata,often, in developing, some
> changes
>
> > may send wrong the fixtures. xloaddata tell you which is last good
> fixture
>
> > loaded before the erroe. (is just a print of obj)
>
> >
>
> The queston on xloaddata wasn't about this, but the use of zip vs gzip vs
> bzip2.
>
> I never use zip for compressing data, just because it's one of the worst
> compressions around. I prefer gzip/bzip/7z/rar (rarely on rar these days).
> Because they are much better compression tools. The only point I can see to
> adding support zip with a single file is to compress it to save some
> diskspace/transfer, the other compressions make more sense to me. If adding
> support for multiple files, zip is only usefull for random access, tar would
> also need to be supported for multiple files. GZip/BZip as they are pure
> compression and have no archiving available to them, without tar. Hence the
> use of tarballs.
>
> gzip, bzip2 and tar all supported as part of the python standard library
> along with zip and just wondering the reason for not using these.
>
> Just a fun fact: I only use zip when dealing with people who are not
> technically inclined and don't understand the different
> compression/archiving tools around and they don't know about 7zip, which is
> very few people these days. This is why I'm curious.
>
>  > xshell instead is a shortcut that load automatically all models of your
>
> > applications. With xshell you don't need to import from the shell your
>
> > models.
>
> >
>
> Got it, not my cup of tea though. In some cases I need to conserve memory
> and this isn't condusive to that... see webfaction's hosting plans for an
> example why I think this way. But nice still.
>
>  > For the utility "scan templates" for obvious XSS mistakes,
>
> > it colud be a good tool, but I need your help to add this feature. I have
>
> > before to understand what you intend for obvious.
>
> >
>
> Well, that's why I linked the thread to you. Because it has the info there,
> but there are certain rules for escaping some data loaded into templates.
>
> See the XSS Prevention Cheet Sheet for examples[1] This would be part of
> the javascript utilities I think. Also see the OP's 1st post in the thread
> linked in the other email for an example of what not to do in Django's
> templates.
>
> If you're not really up on web site security, you should see the owasp
> faq[2] You might be able to find other ways to enhance secure development
> with your toolset. I think I might be interestined in helping you with some
> of this, right now I have one site to build (from scratch) and upgrade 2
> others to 1.3, so time is limited, but I know this would be useful. Lets
> keep an open dialog on this.
>
> For the most part django itself provides a lot of help under the hood for
> alot of it. Like sql injection is bypassed a lot with the whitelisting of
> urls and the orm itself escaping user supplied input and CSRF tokens for
> some XSS attack vectors.
>
> Mike
>
> [1] http://www.owasp.org/index.php/DOM_based_XSS_Prevention_Cheat_Sheet
>
> [2] http://www.owasp.org/index.php/OWASP_Application_Security_FAQ
>
> --
>
> Patch griefs with proverbs.
>
> -- William Shakespeare, "Much Ado About Nothing"
>
>

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



Using markdown within admin interface

2011-02-23 Thread Jonas Geiregat
Hello,

I love markdown for writing content on websites. I use it almost all the time 
when I'm working with django.

The only issue I hate is that the default django admin interface gives you a 
standard textfield. 
There's nothing wrong with that but when you're pasting some code on let's say 
a blog you need to prepend each line of code with 4 spaces (or a tab).
You can imagine that if you have several lines of code this is frustrating. 

So my question is, how do you come around this issue or are there any decent 
editors that work well with markup ?

Regards,

Jonas.

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



Re: Using markdown within admin interface

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 06:36:46 am Jonas Geiregat wrote:
> Hello,
> 
> I love markdown for writing content on websites. I use it almost all the
> time when I'm working with django.
> 
> The only issue I hate is that the default django admin interface gives you
> a standard textfield. There's nothing wrong with that but when you're
> pasting some code on let's say a blog you need to prepend each line of
> code with 4 spaces (or a tab). You can imagine that if you have several
> lines of code this is frustrating.
> 
> So my question is, how do you come around this issue or are there any
> decent editors that work well with markup ?
> 
> Regards,
> 
> Jonas.

tried tinymce[1]? Here is the best (IMO) way to do it.[2] Others have editted 
the admin templates to intregrate tinymce into the admin, but I think this is 
counter-productive.

Also this exists: http://code.google.com/p/django-tinymce/

Mike

[1] http://tinymce.moxiecode.com/
[2] http://stackoverflow.com/questions/1883135/django-admin-tinymce-
integration
-- 
How should I know if it works?  That's what beta testers are for.  I
only coded it.
-- Attributed to Linus Torvalds, somewhere in a posting

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



Re: Using markdown within admin interface

2011-02-23 Thread Tom Evans
On Wed, Feb 23, 2011 at 2:48 PM, Mike Ramirez  wrote:
> tried tinymce[1]? Here is the best (IMO) way to do it.[2] Others have
> editted the admin templates to intregrate tinymce into the admin, but I
> think this is counter-productive.
>
> Also this exists: http://code.google.com/p/django-tinymce/
>
> Mike
>
> [1] http://tinymce.moxiecode.com/
>
> [2]
> http://stackoverflow.com/questions/1883135/django-admin-tinymce-integration
>

tinymce is the antithesis of markdown.

OP: Investigate browser based solutions, that allow you to embed/hook
a proper editor into a textbox, eg:

https://addons.mozilla.org/en-US/firefox/addon/its-all-text/
http://vimperator.mozdev.org/
http://www.vim.org/scripts/script.php?script_id=1242
https://addons.mozilla.org/en-US/firefox/addon/jv/
https://addons.mozilla.org/en-US/firefox/addon/5482

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: Using markdown within admin interface

2011-02-23 Thread Michel Thadeu Sabchuk
Hi,

> I love markdown for writing content on websites. I use it almost all the
> time when I'm working with django.

I like markdown too. I found an wysiwym editor for it:

http://code.google.com/p/wmd/

It is pretty simple to attach it on the admin interface.

Regards,

Michel Sabchuk
Brasil

-- 
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: Querysets: returning a single item with the greatest id.

2011-02-23 Thread christian.posta
Does latest()[0] work exactly as the original poster was looking for?
latest() works based on a date field, not the pk field (which *could*
return a result different than expected).

Tom's approach, explicitly ordering by pk, would work exactly as
desired.

On Feb 23, 6:08 am, Mike Ramirez  wrote:
> On Wednesday, February 23, 2011 05:04:29 am Tom Evans wrote:
>
>
>
>
>
>
>
>
>
> > On Wed, Feb 23, 2011 at 12:57 PM, Sithembewena Lloyd Dube
>
> >  wrote:
> > > Hi everyone,
>
> > > How would one fetch a single item with the largest id (or most recent
> > > date of creation) via the database API?
>
> > > --
> > > Regards,
> > > Sithembewena Lloyd Dube
>
> > Foo.objects.all().order_by('-pk')[0] ?
>
> > Cheers
>
> > Tom
>
> also latest()[0]
>
> Mike
>
>  http://docs.djangoproject.com/en/1.2/ref/models/querysets/#django.db
> --
> Bershere's Formula for Failure:
>         There are only two kinds of people who fail: those who
>         listen to nobody... and those who listen to everybody.

-- 
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-23 Thread Bill Freeman
On Wed, Feb 23, 2011 at 4:51 AM, Tom Evans  wrote:
...
> It takes about a month to get up to speed with vim, about a year to
> become proficient and about three years to be fully comfortable. The
> longer you use vim, the faster you get using it, and the more
> productive you can be compared to users using mouse driven GUIs.
> If you intend making a living out of knocking out 1's and 0's in a
> specific order, it's wise to become fully acquainted with an editor
> that is powerful and concise to use, and then never use anything but
> that editor*.
>
> From The Pragmatic Programmer [1]:
>
> Use a Single Editor Well
> The editor should be an extension of your hand; make sure your editor
> is configurable, extensible, and programmable.
>
> Cheers
>
> Tom

All good points.

I would caution, however, that not every *nix production environment
has vim.  (Less and less true, but I still see them.)

They will, however, have vi.  (And the ones that have vim typically have
vi as an alias.)  If you can use vi, you can get by in vim.  But some of
the vim features you learn aren't there, you could be frustrated.  So, if
you are just learning vi[m] to make quick edits on your production boxes,
and you're not using it for anything else because you already have a
different favorite editor, I'd advise you to limit your self to the vi command
set, until it becomes habit to, for example, reach for the 'j' key rather than
the down arrow when you want to go to the next line (if you were in insert
mode, you obviously need to get out of it before using 'j').

[And few productions systems have emacs, my favorite, installed.  For the
dyed in the wool emacs user, look at the tramp extension, though I haven't
found it totally satisfying.  If your production box does have emacs, consider
ssh's -Y flag, to get emacs to pop up a window on your desktop, rather than
running inside the terminal.  This requires at least the X client libraries on
the production box, and, due to bad packaging, sometimes requires X
server libraries, even though there is no display, and thus no need (or
ability) to run an X server.  There's also NX, but ssh -Y is so easy to set
up.]

Bill

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



Ordering in complex queries

2011-02-23 Thread Akshit Khurana
I want to search from database and return objects in order (soft_name,
category and subcategory are fields of a model)
1st if soft_name has query
then if category has query
and then if subcategory has query

I've written this:

query = request.GET.get('q','')
if query:
 qset = (
Q(soft_name__icontains=query) |
 Q(category__icontains=query) |
 Q(subcategory__icontains=query) |
)
 results = Software.objects.filter(qset).distinct()

But this returns mixed results (not in required order)

Is it possible to obtain results in order without writing 3 queries and
joining the resultant lists?

Thanks
Akshit

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



unittest problems

2011-02-23 Thread refreegrata
Hello list. I have a question. I've never done unit testing with
Django before. I still don't write any unittest but when I do this:

sudo. / manage.py test

Many errors appears. Errors related with the authentication. Errors
like:
==
FAIL: test_confirm_invalid
(django.contrib.auth.tests.views.PasswordResetTest)
--
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
tests/views.py", line 76, in test_confirm_invalid
url, path = self._test_confirm_start()
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
tests/views.py", line 60, in _test_confirm_start
self.assertEquals(len(mail.outbox), 1)
AssertionError: 0 != 1

==
FAIL: test_confirm_invalid_post
(django.contrib.auth.tests.views.PasswordResetTest)
--
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
tests/views.py", line 88, in test_confirm_invalid_post
url, path = self._test_confirm_start()
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
tests/views.py", line 60, in _test_confirm_start
self.assertEquals(len(mail.outbox), 1)
AssertionError: 0 != 1

==
FAIL: test_confirm_valid
(django.contrib.auth.tests.views.PasswordResetTest)
--
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
tests/views.py", line 69, in test_confirm_valid
url, path = self._test_confirm_start()
  File "/usr/local/lib/python2.6/dist-packages/djan

..


==
ERROR: test_last_login
(django.contrib.auth.tests.remote_user.RemoteUserNoCreateTest)
--
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
tests/remote_user.py", line 87, in test_last_login
self.assertNotEqual(default_login,
response.context['user'].last_login)
TypeError: 'NoneType' object is unsubscriptable

==

Some idea?. Another question. My database use something of sql .
Normally when I build the empty database, I insert this query :
'Create language plpgsql'. After  I do :python manage.py syncdb.

But in a test a new database is automatically created. How can I run a
test over an empty database but already created.

Thanks for read and sorry for my poor english.

-- 
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: Ordering in complex queries

2011-02-23 Thread Tom Evans
On Wed, Feb 23, 2011 at 4:23 PM, Akshit Khurana  wrote:
> I want to search from database and return objects in order (soft_name,
> category and subcategory are fields of a model)
>             1st if soft_name has query
>             then if category has query
>             and then if subcategory has query
> I've written this:
> query = request.GET.get('q','')
> if query:
> qset = (
> Q(soft_name__icontains=query) |
> Q(category__icontains=query) |
> Q(subcategory__icontains=query) |
> )
> results = Software.objects.filter(qset).distinct()
> But this returns mixed results (not in required order)
> Is it possible to obtain results in order without writing 3 queries and
> joining the resultant lists?
> Thanks
> Akshit
>

http://docs.djangoproject.com/en/1.2/ref/models/querysets/#order-by

HTH

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

2011-02-23 Thread Tom Evans
On Wed, Feb 23, 2011 at 4:15 PM, Bill Freeman  wrote:
> All good points.
>
> I would caution, however, that not every *nix production environment
> has vim.  (Less and less true, but I still see them.)
>
> They will, however, have vi.  (And the ones that have vim typically have
> vi as an alias.)  If you can use vi, you can get by in vim.  But some of
> the vim features you learn aren't there, you could be frustrated.  So, if
> you are just learning vi[m] to make quick edits on your production boxes,
> and you're not using it for anything else because you already have a
> different favorite editor, I'd advise you to limit your self to the vi command
> set, until it becomes habit to, for example, reach for the 'j' key rather than
> the down arrow when you want to go to the next line (if you were in insert
> mode, you obviously need to get out of it before using 'j').

Eurgh, vi. I'm a FreeBSD man, so all boxes come with nvi, which is a
little more featured than plain old vi, but still more than unusable.
I *can* use vi, just like I *can* write C, fortunately 99.99% of the
time, I don't have to. In these days of TB disks, and GB of RAM, using
vi over vim seems sadistic to me, and so it gets installed on all
boxes as part of our basic package set.

>
> [And few productions systems have emacs, my favorite, installed.  For the
> dyed in the wool emacs user, look at the tramp extension, though I haven't
> found it totally satisfying.

Aargh, we're mortal enemies - I guess Eight Megs And Constantly
Swapping is no longer an insult I can use :)

This is where the pragmatic programmer rule comes in - tried emacs
once, didn't like it. Saw someone using vim like a wizard - code
magically appearing at a faster rate than any human can type, all
beautifully formatted and syntax highlighted - and was hooked.

>From that point, 3 months of daily use till I wasn't repeatedly
referring to the cheat sheet, and felt completely comfortable about a
year after that.

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

2011-02-23 Thread Bill Freeman
On Wed, Feb 23, 2011 at 11:58 AM, Tom Evans  wrote:
...
>
> Aargh, we're mortal enemies - I guess Eight Megs And Constantly
> Swapping is no longer an insult I can use :)

The last time I used a machine with fewer than 8Mb of RAM, emacs
was nowhere near that big.  Besides, what are you running all those
other processes for?  Emacs does it all.

> This is where the pragmatic programmer rule comes in - tried emacs
> once, didn't like it.

I've got to confess, it did take me a while to switch to emacs from teco.
(Of course, at the time emacs was implemented in teco.)

;^) - in case you couldn't tell.

-- 
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: dse 0.6.0 DSE - Delayed SQL Executor

2011-02-23 Thread Thomas Weholt
Just released a new version of DSE - delayed SQL Executor.

Typical 10x speed gain when inserting or updating lots of records
using DSE compared to using the django orm.

http://pypi.python.org/pypi/dse/0.6.0

Comments and feedback appreciated.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.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.



Comparing two annotations

2011-02-23 Thread Patrick
Hi,

i am trying to compare two count-annotations with a simple "greater-
than" filter like this:
ResultSequence.objects.annotate(num_result=Count('resultset'),num_part=Count('seminar__participant')).filter(num_result__gt=num_part)
i also tried doing it like this:
ResultSequence.objects.annotate(num_result=Count('resultset')).annotate(num_part=Count('seminar__participant')).filter(num_result__gt=num_part)
both ways return "NameError: name 'num_part' is not defined"

it seems to be working nicely when i manually set the last parameter:
ResultSequence.objects.annotate(num_result=Count('resultset'),num_part=Count('seminar__participant')).filter(num_result__gt=15)

i dont know if i misunderstand the whole concept of "annotate" or if
this is just impossible to do..

thanks in advance
patrick

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



django cache (memcache) items are not readable between processes

2011-02-23 Thread dcoy
Hi,
I have problems using the django cache. The cached items are not
readable between processes it seems... ?

Testing on the production server using two ssh sessions in parallel,
and setting the cache in one and reading in the other using the
memcache backend.
I ran them each one line at a time, and this was the result:
(session 1)
>>> from django.core.cache import cache
>>> cache.set('foo','bar')
>>> cache.get('foo')
'bar'

(session 2)
>>> from django.core.cache import cache
>>> cache.get('foo', 0)
0
>>> cache.get('foo', 0)
0

Is this a memcache problem or a django problem?

I use the low level cache api to cache the processed results of an
uploaded file. The user then complete some more steps that describe
the uploaded data at which point it's entered in the db. This is done
asynchronously using apache2 with one thread per process, mod_wsgi and
python 2.5. The problem I ran in to was that the "cache.get('key')"
always returns None when I test and upload a file.

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: django cache (memcache) items are not readable between processes

2011-02-23 Thread dcoy
I just tested with the filecache as well, same problem.

On Feb 23, 7:47 pm, dcoy  wrote:
> Hi,
> I have problems using the django cache. The cached items are not
> readable between processes it seems... ?
>
> Testing on the production server using two ssh sessions in parallel,
> and setting the cache in one and reading in the other using the
> memcache backend.
> I ran them each one line at a time, and this was the result:
> (session 1)>>> from django.core.cache import cache
> >>> cache.set('foo','bar')
> >>> cache.get('foo')
>
> 'bar'
>
> (session 2)>>> from django.core.cache import cache
> >>> cache.get('foo', 0)
> 0
> >>> cache.get('foo', 0)
>
> 0
>
> Is this a memcache problem or a django problem?
>
> I use the low level cache api to cache the processed results of an
> uploaded file. The user then complete some more steps that describe
> the uploaded data at which point it's entered in the db. This is done
> asynchronously using apache2 with one thread per process, mod_wsgi and
> python 2.5. The problem I ran in to was that the "cache.get('key')"
> always returns None when I test and upload a file.
>
> 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: Cool and useful development commands :-)

2011-02-23 Thread Ori Livneh
Can't wait to try it! Some nifty things here.

On Tue, Feb 22, 2011 at 11:46 AM, 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: Admin-enabled glossary

2011-02-23 Thread yuri2k
Anyone?

On 23 Fev, 10:14, yuri2k  wrote:
> I need to find a way to use a glossary (sort of 
> likehttps://github.com/kcunning/django-glossary) but that can be called
> when you insert a new entry elsewhere on the data structure (i.e., any
> page with text). The ideal would be to use a tag system to make this
> insertion simple, but ultimately, an html link with a specific class
> will do. The objective is to then have them displayed on the front end
> as tooltips or something similar. Any clues appreciated.

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

2011-02-23 Thread refreegrata
I don't know but maybe the problem is related with this:

I use Middleware class provided by Ryan Witt. Whit this class the user
must to be authenticated to view any page other than LOGIN_URL

Can be this a problem to run the tests?

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

2011-02-23 Thread Shawn Milochik
I have an idea. Why don't you remove the middleware and see if the
tests work? That might give you the answer.

-- 
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: Querysets: returning a single item with the greatest id.

2011-02-23 Thread delegbede
He is expecting to fetch a single term. I think that's what get() does if the 
particular I'd is known and you would have written your code as this:
Foo.objects.get(id=1000)
However, if you don't know like I'm presuming, you do:
Foo.objects.all().order_by('-pk')[0]
Tom, thanks. 
Sent from my BlackBerry wireless device from MTN

-Original Message-
From: Tom Evans 
Sender: django-users@googlegroups.com
Date: Wed, 23 Feb 2011 13:04:29 
To: 
Reply-To: django-users@googlegroups.com
Subject: Re: Querysets: returning a single item with the greatest id.

On Wed, Feb 23, 2011 at 12:57 PM, Sithembewena Lloyd Dube
 wrote:
> Hi everyone,
>
> How would one fetch a single item with the largest id (or most recent date
> of creation) via the database API?
>
> --
> Regards,
> Sithembewena Lloyd Dube
>

Foo.objects.all().order_by('-pk')[0] ?

Cheers

Tom

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

-- 
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: Comparing two annotations

2011-02-23 Thread Daniel Roseman
On Wednesday, February 23, 2011 7:28:06 PM UTC+1, Patrick wrote:
>
> Hi, 
>
> i am trying to compare two count-annotations with a simple "greater- 
> than" filter like this: 
> ResultSequence.objects.annotate(num_result=Count('resultset'),num_part=Count('seminar__participant')).filter(num_result__gt=num_part)
>  
>
> i also tried doing it like this: 
> ResultSequence.objects.annotate(num_result=Count('resultset')).annotate(num_part=Count('seminar__participant')).filter(num_result__gt=num_part)
>  
>
> both ways return "NameError: name 'num_part' is not defined" 
>
> it seems to be working nicely when i manually set the last parameter: 
> ResultSequence.objects.annotate(num_result=Count('resultset'),num_part=Count('seminar__participant')).filter(num_result__gt=15)
>  
>
>
> i dont know if i misunderstand the whole concept of "annotate" or if 
> this is just impossible to do.. 
>
> thanks in advance 
> patrick


The problem is not the annotations, but any time you need to use a field 
value on the right-hand side. See the documentation on this:
http://docs.djangoproject.com/en/1.2/topics/db/queries/#filters-can-reference-fields-on-the-model
--
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: Comparing two annotations

2011-02-23 Thread Patrick
now that makes sense.. thank you daniel!
i better should have rtfm :)

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



Problems with Admin site displaying table records

2011-02-23 Thread wilbur
Hello,

I am using Django version 1.2.4 on Ubuntu 10.04. When I try to click
on an individual database table record in the Django Administration
interface (for editing, for example), I get the following error:


TemplateSyntaxError at /admin/iom_catalog/sample/610/
Caught TypeError while rendering: coercing to Unicode: need string or
buffer, int found

The error is located on line 19 of the fieldset.html administration
template:

17  {{ field.contents }}
18  {% else %}
19  {{ field.field }}
20  {% endif %}
21  {% endif %}

The table I am querying is set to return a fieldname that is defined
as varchar... ex.

class Sample(models.Model):
sample_name = models.CharField(max_length=100)
location = models.CharField(max_length=100,blank=True,null=True)
country = models.CharField(max_length=50,blank=True,null=True)
"other fieldnames defined".
def __unicode__(self):
 #return unicode(self.sample_name)
 return self.sample_name

Could it be that the error refers to one of the fields rendered in the
individual record edit page instead. If so, how do I find out which
one?

Thanks, Bill

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



Django Job Opportunity at IDLE GAMES (The Social Game Changers)

2011-02-23 Thread Aliciasf
**Job Description**:

Idle Games is looking for Software Developers (Python/Django) to join
our small and brilliant team in building a real-time social casual MMO
games platform. We are making original beautiful soon-to-be-released
Blockbuster titles that delight, engage, entertain and will monetize
very well. Our platform is years ahead of it's time; featuring a
persistent, synchronous massive multi-player environment with hand-
drawn fully animated characters.

Have a look at a video of our game demo'd by the CTO of Adobe during
his keynote at the Adobe Max conference: www.idle-games.com.

**Python/Django Software Engineer**

Responsibilities:

* Manage database for multi-player social games that can support
millions of users
* Work closely with development team to integrate game simulation
server with persistence layer
* Help implement build/release process for application
* Guarantee high performance of database server for a massively
multiplayer casual game

**Requirements**

Qualifications:

* Demonstrable fluency in and experience coding all of the primary
components of the Django Framework--i.e., (I) the ORM; (ii) the
request processor; (iii) the URL dispatcher; and (iv) the Tempting
system
* Similar fluency and experience with other key framework components,
in particular, (i) the middleware class structure; (ii) caching
(particularly, memcache); and (iii) form serialization
* Deep understanding of the challenges to a Django production app
caused by rapid and massive scale-out (to > 1 million concurrent);
experience-validated knowledge sufficient to implement solutions to
monitor and interdict problems caused by scale
* 5+ years professional experience in software development
* Advanced MySQL usage (3+ years)
* Excellent Python skills with 2+ years of experience
* Django or similar ORM framework
* Experience distributing traffic across multiple data centers and
tiers of systems
* Proficient in Linux (Ubuntu) including shell scripting
* Experience administering and deploying content management systems
(e.g. Django CMS or Drupal)
* B.S. degree in Computer Science, related or equivalent experience

Nice to Have:

* C/C++ skills highly desirable
* Experience integrating Flash or Flex applications with database
backends
* Web Traffic and High Volume System performance analysis and
monitoring
* Facebook API
* Experience building backends for multiplayer games
* Experience building applications on AWS
* Data Mining
* Localization experience
* Avid gamer

**About the company**

Idle Games is the paradigm shift that everyone has been looking in
social games!

We are executing on the best formula for success starting with our
incredible leader/founder, Rick Thompson. Rick is one of the most
successful serial entrepreneurs/investors in Silicon Valley, having
sold three companies for over $3 billion! (Latest is the sale of
Playdom to Disney for $750 million). Our CEO & Executive Creative
Director, Jeff Hyman, spent the last decade running his own highly
successful Interactive Advertising Agency. He produced TV shows,
commercials, and 35 Flash games, and won 2 CLIOS, 2 Cannes Lions, a
One Show Award & 8 National Addy awards!

We understand the needs of our employees, so all the infrastructure is
in place that will allow you to focus on doing what you do best.
You'll make a huge impact while working with brilliant people solving
interesting and challenging problems. Your ideas, creativity and input
will be encouraged, valued, and directly implemented into our games
and corporate culture.

There's lots of fun here, with life work balance, free dinners and a
Tiki bar!

Come join us and let's make history together!

**Contact Info:**

* **Contact**: Alicia Lin
* **E-mail contact**: ali...@idle-games.com
* **Other Contact Info**: 415-717-1274
* **Web**: http://idle-games.com/careers_engineering.htm#pse

-- 
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 do I authenticate a urllib2 script in order to access HTTPS web services from a Django site?

2011-02-23 Thread carl
It turns out I needed to set the HTTP Referer header to the login page
url in the request where I post the login information.

req.add_header( 'Referer', login_url )

The reason is explained on the Django CSRF documentation -
specifically, step 4.

Due to our somewhat peculiar server setup where we use HTTPS on the
production side and DEBUG=False, I wasn't seeing the csrf_failure
reason for failure (in this case: 'Referer checking failed - no
referer') that is normally output in the DEBUG info. I ended up
printing that failure reason to the Apache error_log and STFW'd on it.
That lead me to code.djangoproject/.../csrf.py and the Referer header
fix.

Thanks to anyone who gave this a read!

On Feb 22, 2:38 pm, carl  wrote:
> 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 grou

Re: Django Job Opportunity at IDLE GAMES (The Social Game Changers)

2011-02-23 Thread Nick Arnett
On Wed, Feb 23, 2011 at 12:35 PM, Aliciasf wrote:

...and (iv) the Tempting system...
>

That's the whole thing, isn't it?

;-)

Nick

-- 
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 unicode in form posts

2011-02-23 Thread Lee Hinde
I had this view function snippet:

   e = Account.objects.create(
user_name = data.get('username'),
password = data.get('password'),
email = data.get('email'),
subscription_number = data.get('subscription_id'),
retrieved = False,
plan  = '60',

)

all was well.

Then the client said, oh, and we need to make sure we don't accept the
same subscription_id more than once.

Ok.

  try:
obj, created =
Account.objects.get_or_create(subscription_number = sub_id)
if created:
obj.user_name = data.get('username'),
obj.password = data.get('password'),
obj.email = data.get('email'),
obj.retrieved = False,
obj.plan  = '60',

obj.save()


Works great.

Except, now the data that's in the database for the username field
goes from looking like this:
leehinde
to this
(u'leehinde',)

I'd like it to be 'leehinde' again
so, clearly objects.create is more clever than my pure post. But I'm
not sure where in the food chain I should be interceding..

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

2011-02-23 Thread refreegrata
Yeahh , I already try this. The number of errors decreases, but I
still have some errors (15)
-
==
ERROR: test_password_change_fails_with_invalid_old_password
(django.contrib.auth.tests.views.ChangePasswordTest)
--
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
tests/views.py", line 147, in
test_password_change_fails_with_invalid_old_password
'new_password2': 'password1',
  File "/usr/local/lib/python2.6/dist-packages/django/test/client.py",
line 322, in post
response = self.request(**r)
  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py", line 100, in get_response
response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py", line 76, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
decorators.py", line 25, in _wrapped_view
return view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
views.py", line 187, in password_change
}, context_instance=RequestContext(request))
  File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/
__init__.py", line 20, in render_to_response
return HttpResponse(loader.render_to_string(*args, **kwargs),
**httpresponse_kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/template/
loader.py", line 181, in render_to_string
t = get_template(template_name)
  File "/usr/local/lib/python2.6/dist-packages/django/template/
loader.py", line 157, in get_template
template, origin = find_template(template_name)
  File "/usr/local/lib/python2.6/dist-packages/django/template/
loader.py", line 138, in find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: registration/password_change_form.html

==
ERROR: test_password_change_fails_with_mismatched_passwords
(django.contrib.auth.tests.views.ChangePasswordTest)
--
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
tests/views.py", line 158, in
test_password_change_fails_with_mismatched_passwords
'new_password2': 'donuts',
  File "/usr/local/lib/python2.6/dist-packages/django/test/client.py",
line 322, in post
response = self.request(**r)
  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py", line 100, in get_response
response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py", line 76, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
decorators.py", line 25, in _wrapped_view
return view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
views.py", line 187, in password_change
}, context_instance=RequestContext(request))
  File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/
__init__.py", line 20, in render_to_response
return HttpResponse(loader.render_to_string(*args, **kwargs),
**httpresponse_kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/template/
loader.py", line 181, in render_to_string
t = get_template(template_name)
  File "/usr/local/lib/python2.6/dist-packages/django/template/
loader.py", line 157, in get_template
template, origin = find_template(template_name)
  File "/usr/local/lib/python2.6/dist-packages/django/template/
loader.py", line 138, in find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: registration/password_change_form.html

==
ERROR: Logout without next_page option renders the default template
--
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
tests/views.py", line 247, in test_logout_default
response = self.client.get('/logout/')
  File "/usr/local/lib/python2.6/dist-packages/django/test/client.py",
line 290, in get
response = self.request(**r)
  File "/usr/local/lib/python2.6/dist-packages/django/test/client.py",
line 230, in request
response = self.handler(environ)
  File "/usr/local/lib/python2.6/dist-packages/django/test/client.py",
line 74, in __call__
response = self.get_response(request)
  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py", line 142, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)
  File "/usr/local/lib

Re: Cool and useful development commands :-)

2011-02-23 Thread Simone Federici
Thanks,
your feedback are welcome
:-D


On Wed, Feb 23, 2011 at 20:00, Ori Livneh  wrote:

> Can't wait to try it! Some nifty things here.
>
> On Tue, Feb 22, 2011 at 11:46 AM, 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.



label_tag in queryset

2011-02-23 Thread geraldcor
Hello all,

When rendering a list of data for a particular model instance, I am
wondering how to access the label_tag attribute for a field when not
using a form.

In my view I get a model instance and pass the object in my context

inspection = inspection.objects.get(pk=3)

Then in my template I want to be able to do the following:

{{ inspection.requester.label_tag }} {{ inspection.requester }}
...

But it seems you can only access label_tag when you are rendering a
form. Any way to do this with a queryset?

Greg

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



Re: Using markdown within admin interface

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 07:10:58 am Tom Evans wrote:
> On Wed, Feb 23, 2011 at 2:48 PM, Mike Ramirez  wrote:
> > tried tinymce[1]? Here is the best (IMO) way to do it.[2] Others have
> > editted the admin templates to intregrate tinymce into the admin, but I
> > think this is counter-productive.
> > 
> > Also this exists: http://code.google.com/p/django-tinymce/
> > 
> > Mike
> > 
> > [1] http://tinymce.moxiecode.com/
> > 
> > [2]
> > http://stackoverflow.com/questions/1883135/django-admin-tinymce-integrati
> > on
> 
> tinymce is the antithesis of markdown.
> 
> OP: Investigate browser based solutions, that allow you to embed/hook
> a proper editor into a textbox, eg:
> 
> https://addons.mozilla.org/en-US/firefox/addon/its-all-text/
> http://vimperator.mozdev.org/
> http://www.vim.org/scripts/script.php?script_id=1242
> https://addons.mozilla.org/en-US/firefox/addon/jv/
> https://addons.mozilla.org/en-US/firefox/addon/5482
> 
> Cheers
> 
> Tom

I was thinking there was a plugin for it, sorry.


Mike
-- 
"I go on working for the same reason a hen goes on laying eggs."
- H. L. Mencken

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



Problems with permissions in the admin panel.

2011-02-23 Thread Adam Tonks
Hello,

I'm having some fustrating problems with setting permissions for a
user within the django administration panel.  I create a new user, set
it as staff, and assign it permissions.  The problem is, when I login
as them, I get the "You don't have permission to edit anything."
error.

I have also tried assigning the user permissions via the groups
method, with no success. It is possible to make them a superuser, but
I'd like to be able to narrow down the user's permissions.

What I've tried/discovered so far:
 - admin.autodiscover() is in the urls.py file
 - deleting and recreating the database does nothing
 - commenting out the applications admin.py file does nothing
 - the project I made originally following the django tutorial allows
me to assign permissions fine, which means it's something to do with
my project

I'm looking for help from anyone who can point me to where I could
have broken the system, and where to look for me to be able to fix it.
I've been stuck on this a good few days now, and I'm not getting
anywhere.

Let me know what extra information would be useful.

Thanks for your help.

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



Re: Problems with permissions in the admin panel.

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 02:56:52 pm Adam Tonks wrote:
> Hello,
> 
> I'm having some fustrating problems with setting permissions for a
> user within the django administration panel.  I create a new user, set
> it as staff, and assign it permissions.  The problem is, when I login
> as them, I get the "You don't have permission to edit anything."
> error.
>  
> I'm looking for help from anyone who can point me to where I could
> have broken the system, and where to look for me to be able to fix it.
> I've been stuck on this a good few days now, and I'm not getting
> anywhere.
> 
> Let me know what extra information would be useful.
> 
> Thanks for your help.

The actual permissions you're assigning the users. 

But just make sure that the user in questions has the `app|model|can change 
model` option selected.

I just tested this out assigning the user the just "can change" permission and 
was able to to change only the app|model in question and removed that and 
added the "can add" permission to the same model, worked as expected. using 
django 1.3 alpha.



Mike.
-- 
"Only a brain-damaged operating system would support task switching and not
make the simple next step of supporting multitasking."
-- George McFry

-- 
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: label_tag in queryset

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 02:15:40 pm geraldcor wrote:
> Hello all,
> 
> When rendering a list of data for a particular model instance, I am
> wondering how to access the label_tag attribute for a field when not
> using a form.
> 
> In my view I get a model instance and pass the object in my context
> 
> inspection = inspection.objects.get(pk=3)
> 
> Then in my template I want to be able to do the following:
> 
> {{ inspection.requester.label_tag }} {{ inspection.requester }} div>
> ...
> 
> But it seems you can only access label_tag when you are rendering a
> form. Any way to do this with a queryset?
> 
> Greg

In this case you're going to want to do it manually, i.e.:

Requester {{ inspection.requester }}

make sure to reference the model field you want as the label if 'Requester' 
isn't it.


Mike.
-- 
"The hottest places in Hell are reserved for those who, in times of moral
crisis, preserved their neutrality."
-- Dante

-- 
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: Problems with Admin site displaying table records

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 11:56:07 am wilbur wrote:
> Hello,
> 
> The table I am querying is set to return a fieldname that is defined
> as varchar... ex.
> 
> class Sample(models.Model):
> sample_name = models.CharField(max_length=100)
> location = models.CharField(max_length=100,blank=True,null=True)
> country = models.CharField(max_length=50,blank=True,null=True)
> "other fieldnames defined".
> def __unicode__(self):
>#return unicode(self.sample_name)
>return self.sample_name
> 
> Could it be that the error refers to one of the fields rendered in the
> individual record edit page instead. If so, how do I find out which
> one?
> 
> Thanks, Bill

I could not reproduce this with (note: both return values work as expected). I 
did get something when __unicode__() did not return a value (typo). But that's 
expected.:

class ArticleCategory(models.Model):
  title = models.CharField(max_length=50,  unique=True)
  description = models.TextField()
  slug = models.SlugField(editable=False)

  def __unicode__(self):
#return u'%s' %(self.title)
return self.title

using django 1.3 alpha  (current trunk)

ftr, you might want to update to django 1.2.5 there is a security release [1], 
it's in the ubuntu repos. But this shouldn't affect your issue.  

Mike

[1] http://www.ubuntu.com/usn/usn-1066-1

-- 
All your files have been destroyed (sorry).  Paul.

-- 
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-23 Thread dave b
On 24 February 2011 00:29, Simone Federici  wrote:
> Maybe you could write a filter "urlsafe" to use into templates so that
> variable does not contains javascript.
> And you could create a command that scan templates and raise an alert every
> variable inside an href attribute that is not "urlsafe".
> But I believe that a tool is used to work, not to do the work for me. And
> Django is a tool.
> It's like the java paradox,  java is a language that hidden a lot of
> problems, and try to resolve them without the programmers. Result: you
> cannot trust a java programmer, because often he doesn't know what the code
> really does.
> For this reason, I see that this kind of problems are better if you leave
> resolve by developers. The better solution is to document better the
> problem.
> I think it is out of the scope of djangodevtools.
> In other words, djangodevtools not is a library to development, but is a
would

That sounds like a good idea  -- "urlsafe".  There already is urlize.
However, it doesn't work for all urls. I was thinking about using
xpath to evaluate the use of variables in 'interesting' places
(attributes) and then checking if the attribute is quoted or not. I
think someone with more django template knowledge can think of a
better way.

I also reported http://code.djangoproject.com/ticket/15365
so now it might be worthwhile searching for markup use in templates.

The best python html sanitization I have so far seen is from from
lxml.html.clean[0]. However it seems to be very much on the too
'strong' side.

[0] - http://lxml.de/lxmlhtml.html#cleaning-up-html

-- 
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: label_tag in queryset

2011-02-23 Thread Greg Corey
Thanks for your reply. One question.


> make sure to reference the model field you want as the label if 'Requester'
> isn't it.
>

Not sure what you mean by this. Do you just mean manually change 'Requester'
to whatever I want, or that I really can reference the model field to get
the label?

Greg

On Wed, Feb 23, 2011 at 4:53 PM, Mike Ramirez  wrote:

>  On Wednesday, February 23, 2011 02:15:40 pm geraldcor wrote:
>
> > Hello all,
>
> >
>
> > When rendering a list of data for a particular model instance, I am
>
> > wondering how to access the label_tag attribute for a field when not
>
> > using a form.
>
> >
>
> > In my view I get a model instance and pass the object in my context
>
> >
>
> > inspection = inspection.objects.get(pk=3)
>
> >
>
> > Then in my template I want to be able to do the following:
>
> >
>
> > {{ inspection.requester.label_tag }} {{ inspection.requester }}
> > div>
>
> > ...
>
> >
>
> > But it seems you can only access label_tag when you are rendering a
>
> > form. Any way to do this with a queryset?
>
> >
>
> > Greg
>
> In this case you're going to want to do it manually, i.e.:
>
> Requester {{ inspection.requester }}
>
> make sure to reference the model field you want as the label if 'Requester'
> isn't it.
>
>  Mike.
>
> --
>
> "The hottest places in Hell are reserved for those who, in times of moral
>
> crisis, preserved their neutrality."
>
> -- Dante
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Problem with unicode in form posts

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 01:17:22 pm Lee Hinde wrote:

> I'd like it to be 'leehinde' again
> so, clearly objects.create is more clever than my pure post. But I'm
> not sure where in the food chain I should be interceding..

I'm not sure what's going on, but I would start with data.get() and verify the 
contents and step through that process slowly, verifying the right data before 
and after the creation, the assignment and save of the obj, with 
get_or_create() (lots of logging/print statements if not using a debugger).  

It should be fine as is though, according to the django docs.



Mike.
-- 
"I keep seeing spots in front of my eyes."
"Did you ever see a doctor?"
"No, just spots."

-- 
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: label_tag in queryset

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 04:16:51 pm Greg Corey wrote:
> Thanks for your reply. One question.
> 
> > make sure to reference the model field you want as the label if
> > 'Requester' isn't it.
> 
> Not sure what you mean by this. Do you just mean manually change
> 'Requester' to whatever I want, or that I really can reference the model
> field to get the label?
> 
> Greg
> 

Both, what ever fits your needs. 

Mike
-- 
To be trusted is a greater compliment than to be loved.

-- 
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-23 Thread Mike Ramirez
just pushing this here for dave to see, I forget that when emails are 
addressed to me and the list, reply sends to the user and do not hit "L" to 
reply to the list.

@dave: This is the idea we came up with.

On Wednesday, February 23, 2011 05:29:55 am you wrote:
> Maybe you could write a filter "urlsafe" to use into templates so that
> variable does not contains javascript.
> And you could create a command that scan templates and raise an alert every
> variable inside an href attribute that is not "urlsafe".
> 

Already has one, this is not the real goal.

> But I believe that a tool is used to work, not to do the work for me. And
> Django is a tool.
> It's like the java paradox,  java is a language that hidden a lot of
> problems, and try to resolve them without the programmers. Result: you
> cannot trust a java programmer, because often he doesn't know what the code
> really does.
> 
> For this reason, I see that this kind of problems are better if you leave
> resolve by developers. The better solution is to document better the
> problem.
> 

I agree here.

> I think it is out of the scope of djangodevtools.
> In other words, djangodevtools not is a library to development, but is a
> library to help the development process itself.
> 
Think of this more of a pylint type tool that helps developers by issuing 
warnings when scanned over the code/template, not changing code for the 
developer.  In this mindset, I can see it being perfect for djangodevtools.  
It still leaves the decision to change it or accept it up to the developers 
and won't hurt running code. 

As pointed out in the previous thread, a lot of developers. Especially new 
developers who think you can just put together some html, some database code 
and come up with a website that's on par with a professionally built one. Also 
at times when it's late in the day, experienced developers are not above 
making simple mistakes. This would help both situations.

Mike.
 
Hey, I had to let awk be better at *something*...  :-)
 -- Larry Wall in <1991nov7.200504.25...@netlabs.com>1

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



Django Code Generator

2011-02-23 Thread Brice Leroy
Hello,

I posted a while ago about this project and since it's pretty complete now,
I'd like to get your opinion on it and advices on features that might be
useful.

The project is hosted on: http://www.djangogenerator.com
The project is open source and available on GIT:
https://github.com/debrice/djangogenerator

The project allows you to:
- Generate model
- Views
- Forms
- Urls

The main goal is:
- Providing code to beginner / teaching tool
- Quickly start a project skeleton and then spend time on customization

Thank you all

Brice Leroy
-- 
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: Django Code Generator

2011-02-23 Thread Mike Dewhirst

On 24/02/2011 11:46am, Brice Leroy wrote:

Hello,

I posted a while ago about this project and since it's pretty complete
now, I'd like to get your opinion on it and advices on features that
might be useful.


I've been interested in this for a while and I'm delighted to see you 
have kept it going. Well done.


I can see the source is freely available on github but I wonder what's 
behind your decision to require a login on the website?


Mike



The project is hosted on: http://www.djangogenerator.com

The project is open source and available on GIT:
https://github.com/debrice/djangogenerator

The project allows you to:
- Generate model
- Views
- Forms
- Urls

The main goal is:
- Providing code to beginner / teaching tool
- Quickly start a project skeleton and then spend time on customization

Thank you all

Brice Leroy
--
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: Django Code Generator

2011-02-23 Thread Brice Leroy
The login is really just so you can manage a bunch of project and easily
come back (as most project often take more than a day to grow). It also
provide some privacy (not everybody wants his project to be publicly
available).

I'd also like to be able to make some project public so they can be "fork"
by other users.

... lots of idea, no so much time :-(

2011/2/23 Mike Dewhirst 

> On 24/02/2011 11:46am, Brice Leroy wrote:
>
>> Hello,
>>
>> I posted a while ago about this project and since it's pretty complete
>> now, I'd like to get your opinion on it and advices on features that
>> might be useful.
>>
>
> I've been interested in this for a while and I'm delighted to see you have
> kept it going. Well done.
>
> I can see the source is freely available on github but I wonder what's
> behind your decision to require a login on the website?
>
> Mike
>
>
>> The project is hosted on: http://www.djangogenerator.com
>> 
>> The project is open source and available on GIT:
>> https://github.com/debrice/djangogenerator
>>
>> The project allows you to:
>> - Generate model
>> - Views
>> - Forms
>> - Urls
>>
>> The main goal is:
>> - Providing code to beginner / teaching tool
>> - Quickly start a project skeleton and then spend time on customization
>>
>> Thank you all
>>
>> Brice Leroy
>> --
>> 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.
>
>


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



Problems with serving static files

2011-02-23 Thread Roy Smith
I'm running r15624, OSX-10.6.5, Python-2.6.1

In my top-level urls.py, I have:

# Serve static
files
(r'^static/(?P.*)$',
 'django.views.static.serve',
 {'document_root': '/Users/roy/dev/try.django/mysite/static',
  'show_indexes': True}),

If I go to http://localhost:8000/static/, I see a listing of my only
static file:

Index of /
site.css

but when I click on the site.css link, I get a 404 ('site.css' could
not be found).  Any ideas what might be going wrong?

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



admin list help

2011-02-23 Thread Bobby Roberts
hi group.  I really need to know how to do something in regard to my
models shown below.  Please consider these three models and then look
at the bottom for my question.

garments
class modela (models.Model):
id = models.AutoField (primary_key=True)
type = models.CharField (max_length=128, blank=False)
order_id = models.IntegerField (blank=False)
lastSave  = models.BigIntegerField (blank=True)

class modelaAdmin(admin.ModelAdmin):
list_display = ('id','type','order_id','lastSave')
search_fields = ['type','order_id','lastSave']
admin.site.register(modela,modelaAdmin)

orders
class modelb (models.Model):
id = models.AutoField (primary_key=True)
title = models.CharField (max_length=128, blank=False)
status = models.CharField(max_length=20, blank=False)
client_id = models.CharField(max_length=11, blank=False)
source = models.CharField (max_length=255, blank=False)

class modelbAdmin(admin.ModelAdmin):
list_display = ('id','title','status','client_id','source')
search_fields = ['title','status','client_id','source']
admin.site.register(modelb,modelbAdmin)


Customer
class modelc (models.Model):
id = models.CharField
(primary_key=True,max_length=10,blank=False)
firstName = models.CharField (max_length=128, blank=False)
lastName = models.CharField (max_length=128, blank=False)
phone = models.CharField (max_length=64, blank=False)
email = models.CharField (max_length=128, blank=False)
comments = models.TextField (blank=False)

class modelcAdmin(admin.ModelAdmin):
list_display =
('id','firstName','lastName','phone','email','comments')
search_fields =
['id','firstName','lastName','phone','email','comments']
admin.site.register(modelc,modelcAdmin)



I am looking to do two things:

1) in the admin list for modela, i would like to show the firstname
and lastname from modelc.

modela is tied to model by by modela.client_id=modelb.id  and modelb
is tied to modelc by modelb.client_id=modelc.id

In addition, I would like to be able to search modela by
modelc.firstname or modelc.lastname


2) in the list view for modela, I would like to show lastSave as a
date/time value. The integer value stored in lastSave is the integer
value of a date.


Are these two things possible to do... if so,  how do i do it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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-23 Thread Andrew Petaisto
Thanks for all the help, I've learned a lot!  I was able to figure out why
the last two wouldn't resolve.  The url part /(?P[-w]+)/$ should be /
(?P[-*\*w]+)/$ that way it looks for all words instead of w's with
-'s. I fixed that and it now works.  Once again thanks for all the help, I
have included the working main urls.py and blog urls.py.

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\d{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\d{1,2})/(?P[-\w]+)/$',
'object_detail', dict(info_dict, template_name='blog/list.html')),

(r'^(?P\d{4})/(?P[a-z]{3})/(?P\d{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')),
)


















(r'(?P\d{4})/(?P[a-z]{3})/(?P\d{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\d{1,2})/(?P[-w]+)/$',
'object_detail', dict(info_dict, template_name='blog/list.html')),

Before only


(r'(?P\d{4})/(?P[a-z]{3})/(?P\d{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\d{1,2})/(?P[-w]+)/$',
'object_detail', dict(info_dict, template_name='blog/list.html')),


On Tue, Feb 22, 2011 at 11:03 PM, Chris Matthews  wrote:

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

Is there an official Django forum besides this mailing list?

2011-02-23 Thread Kevin
Hello everyone,

  I checked the Community link on the Django website and am unable to
locate a web-based forum, but only this mailing list.  There is a few
Django made forum apps which could be used for this purpose, and
integrated into the main website.  I find djangobb to work pretty
good, and am currently using it on a website.  I find that a forum is
much more organized and easier to follow than a mailing list.  Forums
can have separate sections, whereas mailing lists are flat.

Kevin.

-- 
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: Is there an official Django forum besides this mailing list?

2011-02-23 Thread Shawn Milochik
There was just a large amount of conversation on this topic.

People listed some great resources and discussed why things have
evolved to happen the way they do:

https://groups.google.com/d/msg/django-users/0dVLMCIYa94/a5IuaB9V_z4J

-- 
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: Is there an official Django forum besides this mailing list?

2011-02-23 Thread Russell Keith-Magee
On Thu, Feb 24, 2011 at 12:14 PM, Kevin  wrote:
> Hello everyone,
>
>  I checked the Community link on the Django website and am unable to
> locate a web-based forum, but only this mailing list.  There is a few
> Django made forum apps which could be used for this purpose, and
> integrated into the main website.  I find djangobb to work pretty
> good, and am currently using it on a website.  I find that a forum is
> much more organized and easier to follow than a mailing list.  Forums
> can have separate sections, whereas mailing lists are flat.

Hi Kevin,

Sorry to disappoint, but no, there isn't an official Django forum. The
mailing lists (django-users and django-dev) and IRC rooms (#django and
#django-dev on freenode) are the official communication channels for
the project.

Personally, my reaction to forum sites is the exact opposite to yours.
I hate them with a passion, and find them to be a poor substitute for
any halfway decent mail client.

Yours,
Russ Magee %-)

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



Port mod_python.publisher and a Django svnclient

2011-02-23 Thread Kevin
Hello everyone,

  For those interested in the backwards compatibility of the
mod_python.publisher handler in Django, I have made my own version of
it.  This code has yet to be tested in a production environment.  Any
help on improving the code would be great.  You can find the
subversion code at:  http://django.kveroneau.info/svn/node1/publisher/trunk/ls

For a copy of the above subversion client built as a django app:
http://django.kveroneau.info/svn/node1/ajaxsite/trunk/svnclient/ls

  The subversion client is currently being used on two of my websites,
the above one and another website I have built.  It is overall, a very
simple subversion client which views the files of the latest
revision.  I plan on adding more features in the future.  Any help on
this project would also be great as well.

  Both the mod_python.publisher and subversion client are licensed
under the GPL.

  Subversion URL for the mod_python.publisher port:  
svn://zyrixhost.net/publisher/trunk
  Subversion URL for the Django subversion client:
svn://zyrixhost.net/ajaxsite/trunk/svnclient

Enjoy and any bugfixes or suggestions would be great!

Kevin.

-- 
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: Is there an official Django forum besides this mailing list?

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 08:14:17 pm Kevin wrote:
> Hello everyone,
> 
>   I checked the Community link on the Django website and am unable to
> locate a web-based forum, but only this mailing list.  There is a few
> Django made forum apps which could be used for this purpose, and
> integrated into the main website.  I find djangobb to work pretty
> good, and am currently using it on a website.  I find that a forum is
> much more organized and easier to follow than a mailing list.  Forums
> can have separate sections, whereas mailing lists are flat.
> 
> Kevin.


AFAIK, no, stack overflow is a great site for Durango based help though.

Personally, I think of mailing lists exactly the same as forums, without all 
the fluff. Defining 'fluff' as user interaction goodies like voting for 
answers, 'rpg games' based on posting habits and the like.  IMO, forums tend 
to encourage idle conversation and doesn't always end up helping. A mailing 
list is much more concise and I don't need to refresh to see the answer, it 
comes right to my inbox, (I use pop3 access through gmail and get the email 
sent to me this way). I'm able to search it and grep through the emails easier 
than a forum also.  This is a personal opinion on forums and technical related 
topics. 

A forum is great for fan sites and other things and I have used djangobb on a 
site also. I know others have used forums for similar purposes as to a mailing 
list also. But doesn't mean I like it or agree. Forums also tend to attract 
the 'dumb' of the internet, those lacking a lot of common sense.

Now the google mailing list front end/search has a lot left to be desired and 
in some cases it takes me a minute to find something on the google-groups site 
even with the exact subject as the search item.  I also find this true on 
forums.

But I don't think there is a reason why you can't start one.

Mike

-- 
HOST SYSTEM RESPONDING, PROBABLY UP...

-- 
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: Is there an official Django forum besides this mailing list?

2011-02-23 Thread Kevin
Thought I would ask.  Djangobb has a great half way feature of RSS
feeds for each forum section, which can be easily integrated into ones
Mail client or mobile smartphone feed reader.

A good example of what I mean by the RSS feeds can be found here:
http://support.djangobb.org/

In a since, a forum for django-users and another for django-dev would
spawn two RSS feeds from the forum.  Considering the nature of django,
a community project could be started to create a mailing-list/forum
hybrid.  People who prefer mailing lists can still Email a specialized
Email address, and their posts will appear in the correct forum
section.  People who prefer the forum approach can reply to those who
use the mailing list approach and vis versa.

This can all be done with a custom mailman type daemon in Python which
communicates to the Django models to insert posts and Email off
replies from the forum to those who use the mailing list counterpart.

Who ever is interesting in developing such a project with me, I have
some server resources and access to a subversion server to assist in
development efforts.  Just putting that out there.

Kevin.

On Feb 23, 10:19 pm, Russell Keith-Magee 
wrote:
> On Thu, Feb 24, 2011 at 12:14 PM, Kevin  wrote:
> > Hello everyone,
>
> >  I checked the Community link on the Django website and am unable to
> > locate a web-based forum, but only this mailing list.  There is a few
> > Django made forum apps which could be used for this purpose, and
> > integrated into the main website.  I find djangobb to work pretty
> > good, and am currently using it on a website.  I find that a forum is
> > much more organized and easier to follow than a mailing list.  Forums
> > can have separate sections, whereas mailing lists are flat.
>
> Hi Kevin,
>
> Sorry to disappoint, but no, there isn't an official Django forum. The
> mailing lists (django-users and django-dev) and IRC rooms (#django and
> #django-dev on freenode) are the official communication channels for
> the project.
>
> Personally, my reaction to forum sites is the exact opposite to yours.
> I hate them with a passion, and find them to be a poor substitute for
> any halfway decent mail client.
>
> Yours,
> Russ Magee %-)

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

2011-02-23 Thread Brice Leroy
You can of course easily clone the site too as there is very few decencies 
(django registration and a "common" package from my repository). 

I thought that most of the user would find it more convenient to store their 
project online and hit download to get their source code as a tar.gz archive.

(the site doesn't host the source but generates it on demand at download)

Brice Leroy 
Sent from my iPhone

On Feb 23, 2011, at 8:27 PM, Mike Dewhirst  wrote:

> On 24/02/2011 12:06pm, Brice Leroy wrote:
>> The login is really just so you can manage a bunch of project and easily
>> come back (as most project often take more than a day to grow). It also
>> provide some privacy (not everybody wants his project to be publicly
>> available).
> 
> OK - I didn't realise you need to do the development work on your website.
> 
> Mike
> 
>> 
>> I'd also like to be able to make some project public so they can be
>> "fork" by other users.
>> 
>> ... lots of idea, no so much time :-(
>> 
>> 2011/2/23 Mike Dewhirst > >
>> 
>>On 24/02/2011 11:46am, Brice Leroy wrote:
>> 
>>Hello,
>> 
>>I posted a while ago about this project and since it's pretty
>>complete
>>now, I'd like to get your opinion on it and advices on features that
>>might be useful.
>> 
>> 
>>I've been interested in this for a while and I'm delighted to see
>>you have kept it going. Well done.
>> 
>>I can see the source is freely available on github but I wonder
>>what's behind your decision to require a login on the website?
>> 
>>Mike
>> 
>> 
>>The project is hosted on: http://www.djangogenerator.com
>>
>>The project is open source and available on GIT:
>>https://github.com/debrice/djangogenerator
>> 
>>The project allows you to:
>>- Generate model
>>- Views
>>- Forms
>>- Urls
>> 
>>The main goal is:
>>- Providing code to beginner / teaching tool
>>- Quickly start a project skeleton and then spend time on
>>customization
>> 
>>Thank you all
>> 
>>Brice Leroy
>>--
>>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.
>> 
>> 
>> 
>> 
>> --
>> 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.
> 

-- 
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 Code Generator

2011-02-23 Thread Mike Dewhirst

On 24/02/2011 12:06pm, Brice Leroy wrote:

The login is really just so you can manage a bunch of project and easily
come back (as most project often take more than a day to grow). It also
provide some privacy (not everybody wants his project to be publicly
available).


OK - I didn't realise you need to do the development work on your website.

Mike



I'd also like to be able to make some project public so they can be
"fork" by other users.

... lots of idea, no so much time :-(

2011/2/23 Mike Dewhirst mailto:mi...@dewhirst.com.au>>

On 24/02/2011 11:46am, Brice Leroy wrote:

Hello,

I posted a while ago about this project and since it's pretty
complete
now, I'd like to get your opinion on it and advices on features that
might be useful.


I've been interested in this for a while and I'm delighted to see
you have kept it going. Well done.

I can see the source is freely available on github but I wonder
what's behind your decision to require a login on the website?

Mike


The project is hosted on: http://www.djangogenerator.com

The project is open source and available on GIT:
https://github.com/debrice/djangogenerator

The project allows you to:
- Generate model
- Views
- Forms
- Urls

The main goal is:
- Providing code to beginner / teaching tool
- Quickly start a project skeleton and then spend time on
customization

Thank you all

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




--
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: Collaborative text editor with Django

2011-02-23 Thread Anoop Thomas Mathew
Hi Mike,
I think you miss read me. I mean an application to put in the website, not
for coding on desktop. A collaborative text editor within the site, some
pre-built django apps.

Any ideas?

regards,
Anoop
atm
___
Life is short, Live it hard.




On 23 February 2011 18:12, Mike Ramirez  wrote:

>  On Wednesday, February 23, 2011 12:32:55 am Anoop Thomas Mathew wrote:
>
> > Hi,
>
> >
>
> > Is there any collaborative text editing application available for django.
>
> > Has anybody tried with etherpad(www.etherpad.org) along with django?
>
> >
>
> > Please reply,
>
> > Thanks in advance,
>
> > Anoop
>
> >
>
> > atm
>
> > ___
>
> > Life is short, Live it hard.
>
> I like eric5 for this, it's python 3.x though. But great collabrotive tools
> involved, including a chat server and issue tracker.
>
> Gobby is another, but his is more general purpose than coding.
>
>  I've also seen screen + [vi|emacs|nano] for collaboritve coding on the
> server side.
>
>  As for etherpad nope, never have bothered, never heard of it till now
> ftr.
>
> Mike
>
> --
>
> A little pain never hurt anyone.
>
>  --
> 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: Collaborative text editor with Django

2011-02-23 Thread Brice Leroy
I'm very curious to know the use case for this kind of editor. I'm using HG and 
GIT to manage merging and I'm quite happy with those.

Brice Leroy 
Sent from my iPhone

On Feb 23, 2011, at 8:56 PM, Anoop Thomas Mathew  wrote:

> Hi Mike,
> I think you miss read me. I mean an application to put in the website, not 
> for coding on desktop. A collaborative text editor within the site, some 
> pre-built django apps.
> 
> Any ideas? 
> 
> regards,
> Anoop
> atm
> ___
> Life is short, Live it hard.
> 
> 
> 
> 
> On 23 February 2011 18:12, Mike Ramirez  wrote:
> On Wednesday, February 23, 2011 12:32:55 am Anoop Thomas Mathew wrote:
> > Hi,
> >
> > Is there any collaborative text editing application available for django.
> > Has anybody tried with etherpad(www.etherpad.org) along with django?
> >
> > Please reply,
> > Thanks in advance,
> > Anoop
> >
> > atm
> > ___
> > Life is short, Live it hard.
> I like eric5 for this, it's python 3.x though. But great collabrotive tools 
> involved, including a chat server and issue tracker.
> Gobby is another, but his is more general purpose than coding.
> I've also seen screen + [vi|emacs|nano] for collaboritve coding on the server 
> side.
> As for etherpad nope, never have bothered, never heard of it till now ftr.
> Mike
> --
> A little pain never hurt anyone.
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



Re: Collaborative text editor with Django

2011-02-23 Thread Mike Ramirez
On Wednesday, February 23, 2011 08:56:50 pm Anoop Thomas Mathew wrote:
> Hi Mike,
> I think you miss read me. I mean an application to put in the website, not
> for coding on desktop. A collaborative text editor within the site, some
> pre-built django apps.
> 
> Any ideas?
> 
Sorry, in that case nope, not really. Just some things like cometd/orbited (or 
hookbox) and javascript framework to build one. But nothing complete or in 
existance.

Mike
-- 
You know what they say -- the sweetest word in the English language is 
revenge.
-- Peter Beard

-- 
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: Is there an official Django forum besides this mailing list?

2011-02-23 Thread Kenneth Gonsalves
On Wed, 2011-02-23 at 20:14 -0800, Kevin wrote:
> I checked the Community link on the Django website and am unable to
> locate a web-based forum, but only this mailing list 

some of us prefer IRC to forums - try #django on freenode.
-- 
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: Is there an official Django forum besides this mailing list?

2011-02-23 Thread Torsten Bronger
Hallöchen!

Kevin writes:

> I checked the Community link on the Django website and am unable
> to locate a web-based forum, but only this mailing list.  [...]

https://convore.com/ is getting some attraction recently.

> I find that a forum is much more organized and easier to follow
> than a mailing list.  Forums can have separate sections, whereas
> mailing lists are flat.

A forum has a lower barrier for non-techies, and it offers fun
gimmicks.  Besides this, they are a nightmare to follow for any
non-trivial discussion.  Imagine to find related answers in a
conversation with 100+ postings.  Possibly you've used sub-optimal
clients to read mailing lists so far.

Tschö,
Torsten.

-- 
Torsten BrongerJabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.com

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