Re: my frist django project Error

2011-07-10 Thread Gour-Gadadhara Dasa
On Sun, 10 Jul 2011 19:42:17 +0100
Malcolm Box  wrote:

> Cal,
> 
> You are contributing a lot to the django users group, but this
> response isnt in the best spirit of the group. 
> 
> Yes, the op could work out from the traceback what the error was, but
> we were all beginners once. If you compare this post to the how to
> post FAQ its not too bad - at least there's a traceback. 
> 
> Telling someone they need to learn more python isn't helpful - tell
> them that theres a setting missing and how the traceback makes that
> clear. 
> 
> Sorry to pull you up on this but the helpfulness of this list is
> important both to me and the health of the django community. 

+1 


Sincerely,
Gour

-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810




signature.asc
Description: PGP signature


Re: Some thoughts on a package/stack compile system for easy distribution of webapps..

2011-07-10 Thread Roberto De Ioris

>
>>
>
> I assume _start / _end / _size are references to the address space (within
> the binary) where these embedded binaries (in symbol form) are kept??


yes, exactly


>
> Is there any sort of restrictions on maximum allowed symbol size? (looked
> on
> Google, but couldn't find anything)


it is arch-dependent, so on 32 bit you will be limited to about 4gb (and
obviously the whole binary must not be bigger than this). On 64bit the
problem is irrilevant.


>
>
>>
>> Now you can reference this data with all the uWSGI options taking
>> file/path
>>
>> ex:
>>
>> uwsgi --socket :3031 --import sym://embedme_py --import
>> sym://uwsgidecorators_py
>>
>> or
>>
>> uwsgi --ini sym://myfile_ini
>>
>
> Really like the "sym://" protocol reference, that will make CLI usage very
> easy.


forgot to say that sym:// works in module aliasing too:

--pymodule-alias foobar=sym://pippo_py



-- 
Roberto De Ioris
http://unbit.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: need help with calling following complex query

2011-07-10 Thread Venkatraman S
On Mon, Jul 11, 2011 at 10:02 AM, sanket  wrote:

> I think I would go ahead with executing the raw SQL in this case.
> The solution by @Venatraman looks interesting too. I would give it a
> try.
>

Raw-sql and the snippet provided by me would end up generating the same sql.

One advantage of my snippet is, if your db does not support sin/cos
functions(like sqlite3),
then you can go ahead defining funcs which computes the same. Something
like..
from django.db import connection, transaction
cursor = connection.cursor()
import math
connection.connection.create_function('acos', 1,
math.acos)
connection.connection.create_function('cos', 1,
math.cos)
connection.connection.create_function('sin', 1,
math.sin)

-V

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: need help with calling following complex query

2011-07-10 Thread sanket
Thanks all for the help,
I really appreciate it.

I think I would go ahead with executing the raw SQL in this case.
The solution by @Venatraman looks interesting too. I would give it a
try.
I might write a stored procedure if I start getting performance issues
if data starts growing.

Thanks again,
sanket

On Jul 10, 7:33 pm, Venkatraman S  wrote:
> On Mon, Jul 11, 2011 at 7:10 AM, Cal Leeming [Simplicity Media Ltd] <
>
> cal.leem...@simplicitymedialtd.co.uk> wrote:
> > +1 on raw SQL in this instance.
>
> Not exactly, using ORM is pretty easy too. You would do something like this:
>
> results.extra(select={
>                             'distance':
> '(acos(sin(latitude)*sin(%(latitude)f)+cos(latitude)*cos(%(latitude)f)*cos(%(longitude)f-longitude)))'
> % {
>                                  'latitude': latitude,
>                                  'longitude': longitude
>                             }
>                         }).order_by('distance')
>
> -V

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: my frist django project Error

2011-07-10 Thread Kenneth Gonsalves
On Sun, 2011-07-10 at 20:13 +0100, Cal Leeming [Simplicity Media Ltd]
wrote:
> > Telling someone they need to learn more python isn't helpful - tell
> them
> > that theres a setting missing and how the traceback makes that
> clear.
> >
> 
> That's a fair point tbh.
> 
> I'll make sure to use a more friendly approach for future threads like
> this.
> :) 

looks like we need to add a section on how to answer questions also.
-- 
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: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-10 Thread Kenneth Gonsalves
On Sun, 2011-07-10 at 14:39 +0100, Cal Leeming [Simplicity Media Ltd]
wrote:
> We don't seem to have a policy of dealing with mailing list posts in
> which
> the user clearly has no Python experience.
> 
> Therefore, I'd like to hear some thoughts on making an amendment to
> UsingTheMailingList,
> which states:
> 
> """
> Do you have *any* experience at all using Python, or understand the
> basic
> concepts of how Python work?
> 
> If not, please refer to the following before attempting to use Django:
> http://wiki.python.org/moin/BeginnersGuide/Programmers
> 
> """
> 
> This would be just the same principle if someone wanted to learn, say
> "CodeIgniter", but without having to learn PHP. It's just not gonna
> fly,
> right? 

please go ahead and add it.
-- 
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: ANN: django-iadmin

2011-07-10 Thread David Graves
Björn,

I'm working on a project very similar to this one (but have a long way to go
to reach it's maturity), but I do have a working feature that I believe
matches what you're looking for.  The project is at
https://bitbucket.org/graveyboat/gravey and the feature is called
RestrictedModel.  It acts just like a regular model, but the object is
automatically assigned to the user that created it, and the user is allowed
to grant access to any group he/she is in.  Also, any admin can change the
owner of the object.  It can be used by using
gravey.db.models.RestrictedModel and gravey.admin.RestrictedModelAdmin.  As
I mentioned before, the rest of the project has a long way to go, and I need
to get some documentation up, but hopefully this will help you along the
way.

David

2011/7/6 Björn Lindqvist 

> 2011/7/4 sax :
> > Django iAdmin
> >
> > iAdmin is a replacement of standard django admin application.
>
> It is more of an extension of the standard django admin, rather than a
> replacement, isn't it? There are certain limitations in admin that are
> hard to work around such as different permission levels for different
> users. For example, if you want to limit a users access to the blog
> database to only articles the user has created, that's not possible to
> express in admin. I think if someone had the time, a completely
> rewritten and redesigned admin system would be a great project. But
> I'll definitely take a closer look at your project it looks very
> promising!
>
>
> --
> mvh/best regards, Björn Lindqvist
> http://www.footballexperts.net/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-10 Thread Andre Terra
Now that sounds much better!

Cheers,
André

On Sun, Jul 10, 2011 at 12:44 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> How about this..
>
> ---
> Asking question about Python related subjects is fine as long as;
>
> * You follow the same guidelines as the rest of this document
> * The question itself is somehow vaguely related to your Django project
> * You understand that learning Django will involve learning Python as well.
>
> For those who would like to read some tutorials on the basics of Python,
> you could try:
> http://wiki.python.org/moin/BeginnersGuide/Programmers
>
> ---
>
>
> On Sun, Jul 10, 2011 at 4:40 PM, Venkatraman S  wrote:
>
>> Actually, i thought about this a little more...as Brian has suggested, we
>> shouldnt shun away 'prospective' pythonistas.
>> Probably, we can keep the tone a little friendly...
>>
>> --
>>
>> Do you have *any* experience at all using Python, or understand the basic
>> concepts of how Python work?
>> If not, probably you can spend some time learning the basics; this would
>> help you a lot when you get on speed with Django.
>>
>>
>> If not, please refer to the following before attempting to use Django:
>>  http://wiki.python.org/moin/BeginnersGuide/Programmers
>>
>> If you are clueless, then you all the more welcome to the community :)
>>
>> 
>>
>> -V
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, 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: Emailing submitted forms

2011-07-10 Thread Michael Ludvig

On 11/07/11 14:18, Venkatraman S wrote:
On Mon, Jul 11, 2011 at 7:07 AM, Michael Ludvig > wrote:


Now I need to not only save the entered values to the db (that
works well) but I also need to send a copy of the submitted form
to an email address.

I wonder if there is an easy way for rendering the form into a
static html email. Essentially I want to replace all the 
and  widgets with their value and then print it as {{
form.as_submitted }} kind of.

As the form is quite long I don't want to maintain a
field-after-field html template for the results.

Is there any convenient way to do this?


Iterate over the fields in the form in an email template and send that 
template over?


Hmm, yes, that'll do. I was hoping for getting away without the iteration.

Btw, i guess you are using uni-form - its perfect for large forms, as 
you have to only specify the layout as a layout and the rendering is 
taken care of by it.


Nope, I use div-based form with some hacks to create sections. I didn't 
know about uni-form until now, thanks for pointing it out. Just had a 
quick read about it and it looks nice!


*Michal
*/PatMat Ltd./
✉ mlud...@patmat.co.nz 

PatMat Property Solutions - We Buy Houses in Auckland 
/*PatMat Property Solutions


*/http://patmat.co.nz - We Buy Houses in Auckland!

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: need help with calling following complex query

2011-07-10 Thread Venkatraman S
On Mon, Jul 11, 2011 at 7:10 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> +1 on raw SQL in this instance.


Not exactly, using ORM is pretty easy too. You would do something like this:

results.extra(select={
'distance':
'(acos(sin(latitude)*sin(%(latitude)f)+cos(latitude)*cos(%(latitude)f)*cos(%(longitude)f-longitude)))'
% {
 'latitude': latitude,
 'longitude': longitude
}
}).order_by('distance')

-V

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Scaling to 30k requests (malcolm box blog)

2011-07-10 Thread Venkatraman S
Thanks for sharing; in my app(which is no way to be compared with any BIG
site) i was trying to do some optimizations to make it 'fast' - just to
learn more.
I used google page-load , YSlow, and DDT to cleanup most of the expensive
sql queries and other things related to HTML.
I am not using any kind of caching for now, but when i ran ab on my app, i
see that django template rendering is pretty expensive.

Jinja2 seems to be nice and fast; but i have got a tonne of templates and do
not have the time to move them over. There is a GSoC project which, i hope,
would do some justice to this layer to make it fast.

On the DB front, i found that select_related() was a welcome boon ; which i
somehow missed. For eg, when we send a list of departments to a template and
iterate over it in the template, and the department tries to access some
other model, then 'every' access is a db call. So if you are showing 100
departments in one page - then you make 1 call to get all departments and
100calls to get each to access the object in the  'other' models(pretty
painful!)

To learn more about  DB access optimization in Django :
https://docs.djangoproject.com/en/dev/topics/db/optimization/

Having said that, it shows clearly that if you design your app nice and
pretty, you can change anything in your server stack to make it even more
scalable and robust. I would highly recommend, concentrating on architecting
the app first and then thinking about the deployment options.

-V-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: CSRF problem with /i18n/setlang/

2011-07-10 Thread Venkatraman S
Have you set the LANGUAGES in settings.py?
Something like ...
ugettext = lambda s: s
LANGUAGES = (
('de', ugettext('German')),
('fr', ugettext('French')),
('en', ugettext('English')),
)

And in urls.py:
(r'^i18n/', include('django.conf.urls.i18n')),

-V

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Emailing submitted forms

2011-07-10 Thread Venkatraman S
On Mon, Jul 11, 2011 at 7:07 AM, Michael Ludvig wrote:

> **
> Now I need to not only save the entered values to the db (that works well)
> but I also need to send a copy of the submitted form to an email address.
>
> I wonder if there is an easy way for rendering the form into a static html
> email. Essentially I want to replace all the  and  widgets
> with their value and then print it as {{ form.as_submitted }} kind of.
>
> As the form is quite long I don't want to maintain a field-after-field html
> template for the results.
>
> Is there any convenient way to do this?
>

Iterate over the fields in the form in an email template and send that
template over?

Btw, i guess you are using uni-form - its perfect for large forms, as you
have to only specify the layout as a layout and the rendering is taken care
of by it.

-V

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: need help with calling following complex query

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
+1 on raw SQL in this instance.

On Mon, Jul 11, 2011 at 2:36 AM, Jian Chang  wrote:

> Using raw sql is a better idea
>
>
> 2011/7/11 Jonas Geiregat 
>
>>
>>
>> In order to find the places in near by area I want to make following
>> mysql query. but I am not sure how should I translate it using django
>> models and managers.
>>
>>
>> You could execute the raw sql query string, see:
>> https://docs.djangoproject.com/en/dev/topics/db/sql/
>> for more information on the subject. Seeing the complexity of the query
>> and knowing it's a good working version why should you even bother
>> translating it to django's ORM framework ?
>>
>>
>> orig.lat = x
>> orig.lon = y
>>
>> "SELECT  destination.*,
>> 3956 * 2 * ASIN(SQRT(  POWER(SIN((orig.lat - dest.lat) * pi()/180 /
>> 2), 2) +
>> COS(orig.lat * pi()/180) *  COS(dest.lat * pi()/180) *
>> POWER(SIN((orig.lon -dest.lon) * pi()/180 / 2), 2)  )) as
>> distance
>> FROM place as dest
>> WHERE  dest.longitude
>> BETWEEN lon1 and lon2
>> AND dest.latitude
>> BETWEEN lat1 and lat2
>> "
>>
>> the model which talks to database is called Place in my case.
>>
>> Thank you all for the help,
>> sanket
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>>
>> Jonas Geiregat
>> jo...@geiregat.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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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.



Emailing submitted forms

2011-07-10 Thread Michael Ludvig

Hi,

I've got a pretty lengthy form in Django 1.2.5 - it renders well with {{ 
form.as_p }}.


Now I need to not only save the entered values to the db (that works 
well) but I also need to send a copy of the submitted form to an email 
address.


I wonder if there is an easy way for rendering the form into a static 
html email. Essentially I want to replace all the  and  
widgets with their value and then print it as {{ form.as_submitted }} 
kind of.


As the form is quite long I don't want to maintain a field-after-field 
html template for the results.


Is there any convenient way to do this?

Thanks!

*Michal
*/PatMat Ltd./
✉ mlud...@patmat.co.nz 

PatMat Property Solutions - We Buy Houses in Auckland 
/*PatMat Property Solutions


*/http://patmat.co.nz - We Buy Houses in Auckland!

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: need help with calling following complex query

2011-07-10 Thread Jian Chang
Using raw sql is a better idea

2011/7/11 Jonas Geiregat 

>
>
> In order to find the places in near by area I want to make following
> mysql query. but I am not sure how should I translate it using django
> models and managers.
>
>
> You could execute the raw sql query string, see:
> https://docs.djangoproject.com/en/dev/topics/db/sql/
> for more information on the subject. Seeing the complexity of the query and
> knowing it's a good working version why should you even bother translating
> it to django's ORM framework ?
>
>
> orig.lat = x
> orig.lon = y
>
> "SELECT  destination.*,
> 3956 * 2 * ASIN(SQRT(  POWER(SIN((orig.lat - dest.lat) * pi()/180 /
> 2), 2) +
> COS(orig.lat * pi()/180) *  COS(dest.lat * pi()/180) *
> POWER(SIN((orig.lon -dest.lon) * pi()/180 / 2), 2)  )) as
> distance
> FROM place as dest
> WHERE  dest.longitude
> BETWEEN lon1 and lon2
> AND dest.latitude
> BETWEEN lat1 and lat2
> "
>
> the model which talks to database is called Place in my case.
>
> Thank you all for the help,
> sanket
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>
> Jonas Geiregat
> jo...@geiregat.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.
>

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

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
Damn, I guess it had unexpected side effects.

Sorry I couldn't help get you up and running :/

Cal

On Mon, Jul 11, 2011 at 2:08 AM, leo  wrote:

>  hi,guy,
> your code works but not very well. i got this error:
>
>
>- Please enable javascript.
>
>
>   and the layout of index page of admin got mess,
> I have to sleep not :),but I will follow the code update.
> thanks to answer my questions.
>
>
>
> On 2011/7/11 8:37, Cal Leeming [Simplicity Media Ltd] wrote:
>
> Oh and, the fix I pasted here is *somewhat* hacky, and is really just meant
> to get you off the ground. The maintainer will need to patch this at a later
> date though.
>
>  Cal
>
> On Mon, Jul 11, 2011 at 1:36 AM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Hmm, grp is only valid on unix platforms according to here:
>>
>>  http://docs.python.org/library/grp.html
>>
>>
>> https://github.com/saxix/django-iadmin/blob/master/iadmin/plugins/fm/fs.py
>>
>>  *line 4-6:*
>>
>> from grp import getgrgid
>>
>>  from pwd import getpwuid
>>
>>  *Replace with this:*
>> *
>> *
>> import os
>> if not os.name == 'nt':
>> from grp import getgrgid
>> from pwd import getpwuid
>>
>>
>>  *line 40-41:*
>>
>> self.user = getpwuid(itemstat.st_uid)[0]
>>
>> self.group = getgrgid(itemstat.st_gid)[0]
>>
>>   *Replace with this:*
>>
>>  if not os.name == 'nt':
>>  self.user = getpwuid(itemstat.st_uid)[0]
>> self.group = getgrgid(itemstat.st_gid)[0]
>>  else:
>>  self.user = 0
>> self.group = 0
>>
>>  This may or may not work lol.
>>
>>  Cal
>>
>> On Mon, Jul 11, 2011 at 1:31 AM, leo  wrote:
>>
>>>  hi, sax
>>> After downloading the newest code and i try to implement the iadmin
>>> the setup works well this time but when I try to access the
>>> localhost/admin
>>> got the follow error ,
>>>
>>> My platform Win2008R2, python 2.6.6
>>>
>>> I checked the code found something,
>>> I write my code in Win, and in Win python can not import grp.
>>> but when i try import in FreeBSD it works.My win's python install
>>> by default.
>>> So I think your iadmin is not suitable for Windows now.
>>>
>>>
>>>  ImportError at /admin
>>>
>>> No module named grp
>>>
>>>   Request Method: GET  Request URL: http://localhost:/admin  Django
>>> Version: 1.3  Exception Type: ImportError  Exception Value:
>>>
>>> No module named grp
>>>
>>>   Exception Location: D:\Python26\lib\site-packages\iadmin\plugins\fm\fs.py
>>> in , line 4  Python Executable: D:\Python26\python.exe  Python
>>> Version: 2.6.6  Python Path:
>>>
>>> ['D:\\Documents\\Workspace\\server',
>>>  'C:\\Windows\\system32\\python26.zip',
>>>  'D:\\Python26\\DLLs',
>>>  'D:\\Python26\\lib',
>>>  'D:\\Python26\\lib\\plat-win',
>>>  'D:\\Python26\\lib\\lib-tk',
>>>  'D:\\Python26',
>>>  'D:\\Python26\\lib\\site-packages']
>>>
>>>   Server time: Mon, 11 Jul 2011 08:22:54 +0800
>>>
>>>
>>>
>>>
>>>
>>> On 2011/7/10 12:30, leo wrote:
>>>
>>> hi, sax
>>> I downloaded the package and want to install is using normal way
>>> then I got error like this:
>>>
>>> D:\saxix-django-iadmin-ec7ad2a>setup.py install
>>> Traceback (most recent call last):
>>>   File "D:\saxix-django-iadmin-ec7ad2a\setup.py", line 44, in 
>>> version = ".".join(iadmin.__version__),
>>> TypeError: sequence item 0: expected string, int found
>>>
>>> I got confused because the package install procedure is different
>>> with online's manual...
>>>
>>>
>>>
>>> On 2011/7/5 3:26, sax wrote:
>>>
>>> yep, but more test needed
>>>
>>> sax
>>>
>>>
>>>
>>> 2011/7/4 Fred Chevitarese 
>>>
 Hmmm I like it !

  All those features are already working?


  ^^


  "
 *O relógio da vida recebe corda apenas uma vez.*
 *Ninguém tem o poder de decidir quando os ponteiros pararão, se mais
 cedo ou se mais tarde.*
 *O presente é o único tempo que você possui.*
 *Viva, ame e trabalhe com vontade.*
  *Não ponha nenhuma esperança no tempo, pois o relógio pode parar a
 qualquer momento.*
 "

  Fred Chevitarese - GNU/Linux
 http://chevitarese.wordpress.com





  2011/7/4 creecode 

> Sounds interesting!  Thanks!
>
>
> On Monday, July 4, 2011 11:06:44 AM UTC-7, sax wrote:
>>
>> Django iAdmin
>>
>> iAdmin is a replacement of standard django admin application.
>> Features
>>
>>- multiple columns portlets-like home page
>>- tabbed view of inlines
>>- mass updates functionality
>>- export to csv with options and formatting
>>- advanced import from csv with foreign key handling
>>- link to foreignkey edit page from changelist
>>(list_display_rel_links)
>>- filter by cell values (cell_filters)
>>- ajax autocomplete widgets for ForeignKey
>>- auto register missed modules.
>>- auto add 

CSRF problem with /i18n/setlang/

2011-07-10 Thread cjwalter
Hi all

I continue getting

CSRF token missing or incorrect.

when trying to call /i18n/setlang/

Here the pertinent snippets from settings.py:

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

and from templates/base.html:

{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}


{% csrf_token %}


{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
{{ language.name_local }}
({{ language.code }})
{% endfor %}




What else is needed??

TIA

  --ChrisW

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

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
I've submitted an issue to the maintainer:

https://github.com/saxix/django-iadmin/issues/4


On Mon, Jul 11, 2011 at 1:37 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Oh and, the fix I pasted here is *somewhat* hacky, and is really just meant
> to get you off the ground. The maintainer will need to patch this at a later
> date though.
>
> Cal
>
>
> On Mon, Jul 11, 2011 at 1:36 AM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Hmm, grp is only valid on unix platforms according to here:
>>
>> http://docs.python.org/library/grp.html
>>
>> https://github.com/saxix/django-iadmin/blob/master/iadmin/plugins/fm/fs.py
>>
>> *line 4-6:*
>>
>> from grp import getgrgid
>>
>> from pwd import getpwuid
>>
>>
>> *Replace with this:*
>> *
>> *
>> import os
>> if not os.name == 'nt':
>> from grp import getgrgid
>> from pwd import getpwuid
>>
>>
>> *line 40-41:*
>>
>> self.user = getpwuid(itemstat.st_uid)[0]
>>
>> self.group = getgrgid(itemstat.st_gid)[0]
>>
>>
>> *Replace with this:*
>>
>> if not os.name == 'nt':
>> self.user = getpwuid(itemstat.st_uid)[0]
>> self.group = getgrgid(itemstat.st_gid)[0]
>> else:
>> self.user = 0
>> self.group = 0
>>
>> This may or may not work lol.
>>
>> Cal
>>
>> On Mon, Jul 11, 2011 at 1:31 AM, leo  wrote:
>>
>>>  hi, sax
>>> After downloading the newest code and i try to implement the iadmin
>>> the setup works well this time but when I try to access the
>>> localhost/admin
>>> got the follow error ,
>>>
>>> My platform Win2008R2, python 2.6.6
>>>
>>> I checked the code found something,
>>> I write my code in Win, and in Win python can not import grp.
>>> but when i try import in FreeBSD it works.My win's python install
>>> by default.
>>> So I think your iadmin is not suitable for Windows now.
>>>
>>>
>>>  ImportError at /admin
>>>
>>> No module named grp
>>>
>>>   Request Method: GET  Request URL: http://localhost:/admin  Django
>>> Version: 1.3  Exception Type: ImportError  Exception Value:
>>>
>>> No module named grp
>>>
>>>   Exception Location: D:\Python26\lib\site-packages\iadmin\plugins\fm\fs.py
>>> in , line 4  Python Executable: D:\Python26\python.exe  Python
>>> Version: 2.6.6  Python Path:
>>>
>>> ['D:\\Documents\\Workspace\\server',
>>>  'C:\\Windows\\system32\\python26.zip',
>>>  'D:\\Python26\\DLLs',
>>>  'D:\\Python26\\lib',
>>>  'D:\\Python26\\lib\\plat-win',
>>>  'D:\\Python26\\lib\\lib-tk',
>>>  'D:\\Python26',
>>>  'D:\\Python26\\lib\\site-packages']
>>>
>>>   Server time: Mon, 11 Jul 2011 08:22:54 +0800
>>>
>>>
>>>
>>>
>>>
>>> On 2011/7/10 12:30, leo wrote:
>>>
>>> hi, sax
>>> I downloaded the package and want to install is using normal way
>>> then I got error like this:
>>>
>>> D:\saxix-django-iadmin-ec7ad2a>setup.py install
>>> Traceback (most recent call last):
>>>   File "D:\saxix-django-iadmin-ec7ad2a\setup.py", line 44, in 
>>> version = ".".join(iadmin.__version__),
>>> TypeError: sequence item 0: expected string, int found
>>>
>>> I got confused because the package install procedure is different
>>> with online's manual...
>>>
>>>
>>>
>>> On 2011/7/5 3:26, sax wrote:
>>>
>>> yep, but more test needed
>>>
>>> sax
>>>
>>>
>>>
>>> 2011/7/4 Fred Chevitarese 
>>>
 Hmmm I like it !

  All those features are already working?


  ^^


  "
 *O relógio da vida recebe corda apenas uma vez.*
 *Ninguém tem o poder de decidir quando os ponteiros pararão, se mais
 cedo ou se mais tarde.*
 *O presente é o único tempo que você possui.*
 *Viva, ame e trabalhe com vontade.*
  *Não ponha nenhuma esperança no tempo, pois o relógio pode parar a
 qualquer momento.*
 "

  Fred Chevitarese - GNU/Linux
 http://chevitarese.wordpress.com





  2011/7/4 creecode 

> Sounds interesting!  Thanks!
>
>
> On Monday, July 4, 2011 11:06:44 AM UTC-7, sax wrote:
>>
>> Django iAdmin
>>
>> iAdmin is a replacement of standard django admin application.
>> Features
>>
>>- multiple columns portlets-like home page
>>- tabbed view of inlines
>>- mass updates functionality
>>- export to csv with options and formatting
>>- advanced import from csv with foreign key handling
>>- link to foreignkey edit page from changelist
>>(list_display_rel_links)
>>- filter by cell values (cell_filters)
>>- ajax autocomplete widgets for ForeignKey
>>- auto register missed modules.
>>- auto add fields not present in fieldset (add_undefined_fields)
>>- utilities ( tabular_factory)
>>- info page for packages and application version
>>- integrated file manager with upload/zip functionality
>>- WYSIWYG editor wymeditor
>>- shortcuts to configure 

Re: ANN: django-iadmin

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
Oh and, the fix I pasted here is *somewhat* hacky, and is really just meant
to get you off the ground. The maintainer will need to patch this at a later
date though.

Cal

On Mon, Jul 11, 2011 at 1:36 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hmm, grp is only valid on unix platforms according to here:
>
> http://docs.python.org/library/grp.html
>
> https://github.com/saxix/django-iadmin/blob/master/iadmin/plugins/fm/fs.py
>
> *line 4-6:*
>
> from grp import getgrgid
>
> from pwd import getpwuid
>
> *Replace with this:*
> *
> *
> import os
> if not os.name == 'nt':
> from grp import getgrgid
> from pwd import getpwuid
>
>
> *line 40-41:*
>
> self.user = getpwuid(itemstat.st_uid)[0]
> self.group = getgrgid(itemstat.st_gid)[0]
>
> *Replace with this:*
>
> if not os.name == 'nt':
> self.user = getpwuid(itemstat.st_uid)[0]
> self.group = getgrgid(itemstat.st_gid)[0]
> else:
> self.user = 0
> self.group = 0
>
> This may or may not work lol.
>
> Cal
>
> On Mon, Jul 11, 2011 at 1:31 AM, leo  wrote:
>
>>  hi, sax
>> After downloading the newest code and i try to implement the iadmin
>> the setup works well this time but when I try to access the
>> localhost/admin
>> got the follow error ,
>>
>> My platform Win2008R2, python 2.6.6
>>
>> I checked the code found something,
>> I write my code in Win, and in Win python can not import grp.
>> but when i try import in FreeBSD it works.My win's python install
>> by default.
>> So I think your iadmin is not suitable for Windows now.
>>
>>
>>  ImportError at /admin
>>
>> No module named grp
>>
>>   Request Method: GET  Request URL: http://localhost:/admin  Django
>> Version: 1.3  Exception Type: ImportError  Exception Value:
>>
>> No module named grp
>>
>>   Exception Location: D:\Python26\lib\site-packages\iadmin\plugins\fm\fs.py
>> in , line 4  Python Executable: D:\Python26\python.exe  Python
>> Version: 2.6.6  Python Path:
>>
>> ['D:\\Documents\\Workspace\\server',
>>  'C:\\Windows\\system32\\python26.zip',
>>  'D:\\Python26\\DLLs',
>>  'D:\\Python26\\lib',
>>  'D:\\Python26\\lib\\plat-win',
>>  'D:\\Python26\\lib\\lib-tk',
>>  'D:\\Python26',
>>  'D:\\Python26\\lib\\site-packages']
>>
>>   Server time: Mon, 11 Jul 2011 08:22:54 +0800
>>
>>
>>
>>
>>
>> On 2011/7/10 12:30, leo wrote:
>>
>> hi, sax
>> I downloaded the package and want to install is using normal way
>> then I got error like this:
>>
>> D:\saxix-django-iadmin-ec7ad2a>setup.py install
>> Traceback (most recent call last):
>>   File "D:\saxix-django-iadmin-ec7ad2a\setup.py", line 44, in 
>> version = ".".join(iadmin.__version__),
>> TypeError: sequence item 0: expected string, int found
>>
>> I got confused because the package install procedure is different
>> with online's manual...
>>
>>
>>
>> On 2011/7/5 3:26, sax wrote:
>>
>> yep, but more test needed
>>
>> sax
>>
>>
>>
>> 2011/7/4 Fred Chevitarese 
>>
>>> Hmmm I like it !
>>>
>>>  All those features are already working?
>>>
>>>
>>>  ^^
>>>
>>>
>>>  "
>>> *O relógio da vida recebe corda apenas uma vez.*
>>> *Ninguém tem o poder de decidir quando os ponteiros pararão, se mais
>>> cedo ou se mais tarde.*
>>> *O presente é o único tempo que você possui.*
>>> *Viva, ame e trabalhe com vontade.*
>>>  *Não ponha nenhuma esperança no tempo, pois o relógio pode parar a
>>> qualquer momento.*
>>> "
>>>
>>>  Fred Chevitarese - GNU/Linux
>>> http://chevitarese.wordpress.com
>>>
>>>
>>>
>>>
>>>
>>>  2011/7/4 creecode 
>>>
 Sounds interesting!  Thanks!


 On Monday, July 4, 2011 11:06:44 AM UTC-7, sax wrote:
>
> Django iAdmin
>
> iAdmin is a replacement of standard django admin application.
> Features
>
>- multiple columns portlets-like home page
>- tabbed view of inlines
>- mass updates functionality
>- export to csv with options and formatting
>- advanced import from csv with foreign key handling
>- link to foreignkey edit page from changelist
>(list_display_rel_links)
>- filter by cell values (cell_filters)
>- ajax autocomplete widgets for ForeignKey
>- auto register missed modules.
>- auto add fields not present in fieldset (add_undefined_fields)
>- utilities ( tabular_factory)
>- info page for packages and application version
>- integrated file manager with upload/zip functionality
>- WYSIWYG editor wymeditor
>- shortcuts to configure django.contrib.* applications
>
>   --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
  To view this discussion on the web visit
 https://groups.google.com/d/msg/django-users/-/PCtWyR-jwVMJ.

 To post to this group, send email to django-users@googlegroups.com.
 To unsubscribe from this group, send email to
 

Re: ANN: django-iadmin

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
Hmm, grp is only valid on unix platforms according to here:

http://docs.python.org/library/grp.html

https://github.com/saxix/django-iadmin/blob/master/iadmin/plugins/fm/fs.py

*line 4-6:*

from grp import getgrgid

from pwd import getpwuid

*Replace with this:*
*
*
import os
if not os.name == 'nt':
from grp import getgrgid
from pwd import getpwuid


*line 40-41:*

self.user = getpwuid(itemstat.st_uid)[0]
self.group = getgrgid(itemstat.st_gid)[0]

*Replace with this:*

if not os.name == 'nt':
self.user = getpwuid(itemstat.st_uid)[0]
self.group = getgrgid(itemstat.st_gid)[0]
else:
self.user = 0
self.group = 0

This may or may not work lol.

Cal

On Mon, Jul 11, 2011 at 1:31 AM, leo  wrote:

>  hi, sax
> After downloading the newest code and i try to implement the iadmin
> the setup works well this time but when I try to access the localhost/admin
> got the follow error ,
>
> My platform Win2008R2, python 2.6.6
>
> I checked the code found something,
> I write my code in Win, and in Win python can not import grp.
> but when i try import in FreeBSD it works.My win's python install
> by default.
> So I think your iadmin is not suitable for Windows now.
>
>
>  ImportError at /admin
>
> No module named grp
>
>   Request Method: GET  Request URL: http://localhost:/admin  Django
> Version: 1.3  Exception Type: ImportError  Exception Value:
>
> No module named grp
>
>   Exception Location: D:\Python26\lib\site-packages\iadmin\plugins\fm\fs.py
> in , line 4  Python Executable: D:\Python26\python.exe  Python
> Version: 2.6.6  Python Path:
>
> ['D:\\Documents\\Workspace\\server',
>  'C:\\Windows\\system32\\python26.zip',
>  'D:\\Python26\\DLLs',
>  'D:\\Python26\\lib',
>  'D:\\Python26\\lib\\plat-win',
>  'D:\\Python26\\lib\\lib-tk',
>  'D:\\Python26',
>  'D:\\Python26\\lib\\site-packages']
>
>   Server time: Mon, 11 Jul 2011 08:22:54 +0800
>
>
>
>
>
> On 2011/7/10 12:30, leo wrote:
>
> hi, sax
> I downloaded the package and want to install is using normal way
> then I got error like this:
>
> D:\saxix-django-iadmin-ec7ad2a>setup.py install
> Traceback (most recent call last):
>   File "D:\saxix-django-iadmin-ec7ad2a\setup.py", line 44, in 
> version = ".".join(iadmin.__version__),
> TypeError: sequence item 0: expected string, int found
>
> I got confused because the package install procedure is different
> with online's manual...
>
>
>
> On 2011/7/5 3:26, sax wrote:
>
> yep, but more test needed
>
> sax
>
>
>
> 2011/7/4 Fred Chevitarese 
>
>> Hmmm I like it !
>>
>>  All those features are already working?
>>
>>
>>  ^^
>>
>>
>>  "
>> *O relógio da vida recebe corda apenas uma vez.*
>> *Ninguém tem o poder de decidir quando os ponteiros pararão, se mais cedo
>> ou se mais tarde.*
>> *O presente é o único tempo que você possui.*
>> *Viva, ame e trabalhe com vontade.*
>>  *Não ponha nenhuma esperança no tempo, pois o relógio pode parar a
>> qualquer momento.*
>> "
>>
>>  Fred Chevitarese - GNU/Linux
>> http://chevitarese.wordpress.com
>>
>>
>>
>>
>>
>>  2011/7/4 creecode 
>>
>>> Sounds interesting!  Thanks!
>>>
>>>
>>> On Monday, July 4, 2011 11:06:44 AM UTC-7, sax wrote:

 Django iAdmin

 iAdmin is a replacement of standard django admin application.
 Features

- multiple columns portlets-like home page
- tabbed view of inlines
- mass updates functionality
- export to csv with options and formatting
- advanced import from csv with foreign key handling
- link to foreignkey edit page from changelist
(list_display_rel_links)
- filter by cell values (cell_filters)
- ajax autocomplete widgets for ForeignKey
- auto register missed modules.
- auto add fields not present in fieldset (add_undefined_fields)
- utilities ( tabular_factory)
- info page for packages and application version
- integrated file manager with upload/zip functionality
- WYSIWYG editor wymeditor
- shortcuts to configure django.contrib.* applications

   --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>>  To view this discussion on the web visit
>>> https://groups.google.com/d/msg/django-users/-/PCtWyR-jwVMJ.
>>>
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, 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
>> 

Re: ANN: django-iadmin

2011-07-10 Thread leo

hi, sax
After downloading the newest code and i try to implement the iadmin
the setup works well this time but when I try to access the localhost/admin
got the follow error ,

My platform Win2008R2, python 2.6.6

I checked the code found something,
I write my code in Win, and in Win python can not import grp.
but when i try import in FreeBSD it works.My win's python install
by default.
So I think your iadmin is not suitable for Windows now.


 ImportError at /admin

No module named grp

Request Method: GET
Request URL:http://localhost:/admin
Django Version: 1.3
Exception Type: ImportError
Exception Value:

No module named grp

Exception Location: 
D:\Python26\lib\site-packages\iadmin\plugins\fm\fs.py in , line 4

Python Executable:  D:\Python26\python.exe
Python Version: 2.6.6
Python Path:

['D:\\Documents\\Workspace\\server',
 'C:\\Windows\\system32\\python26.zip',
 'D:\\Python26\\DLLs',
 'D:\\Python26\\lib',
 'D:\\Python26\\lib\\plat-win',
 'D:\\Python26\\lib\\lib-tk',
 'D:\\Python26',
 'D:\\Python26\\lib\\site-packages']

Server time:Mon, 11 Jul 2011 08:22:54 +0800






On 2011/7/10 12:30, leo wrote:

hi, sax
I downloaded the package and want to install is using normal way
then I got error like this:

D:\saxix-django-iadmin-ec7ad2a>setup.py install
Traceback (most recent call last):
  File "D:\saxix-django-iadmin-ec7ad2a\setup.py", line 44, in 
version = ".".join(iadmin.__version__),
TypeError: sequence item 0: expected string, int found

I got confused because the package install procedure is different
with online's manual...



On 2011/7/5 3:26, sax wrote:

yep, but more test needed

sax



2011/7/4 Fred Chevitarese >


Hmmm I like it !

All those features are already working?


^^


"
/O relógio da vida recebe corda apenas uma vez./
/Ninguém tem o poder de decidir quando os ponteiros pararão, se
mais cedo ou se mais tarde./
/O presente é o único tempo que você possui./
/Viva, ame e trabalhe com vontade./
/Não ponha nenhuma esperança no tempo, pois o relógio pode parar
a qualquer momento./
"

Fred Chevitarese - GNU/Linux
http://chevitarese.wordpress.com





2011/7/4 creecode >

Sounds interesting!  Thanks!


On Monday, July 4, 2011 11:06:44 AM UTC-7, sax wrote:


  Django iAdmin

iAdmin is a replacement of standard django admin application.


Features

  * multiple columns portlets-like home page
  * tabbed view of inlines
  * mass updates functionality
  * export to csv with options and formatting
  * advanced import from csv with foreign key handling
  * link to foreignkey edit page from changelist
(list_display_rel_links)
  * filter by cell values (cell_filters)
  * ajax autocomplete widgets for ForeignKey
  * auto register missed modules.
  * auto add fields not present in fieldset
(add_undefined_fields)
  * utilities ( tabular_factory)
  * info page for packages and application version
  * integrated file manager with upload/zip functionality
  * WYSIWYG editor wymeditor
  * shortcuts to configure django.contrib.* applications

-- 
You received this message because you are subscribed to the

Google Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/PCtWyR-jwVMJ.

To post to this group, send email to
django-users@googlegroups.com
.
To unsubscribe from this group, 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.


--
chlin


--
chlin

--

Re: need help with calling following complex query

2011-07-10 Thread Jonas Geiregat
> 
> 
> In order to find the places in near by area I want to make following
> mysql query. but I am not sure how should I translate it using django
> models and managers.

You could execute the raw sql query string, see: 
https://docs.djangoproject.com/en/dev/topics/db/sql/
for more information on the subject. Seeing the complexity of the query and 
knowing it's a good working version why should you even bother translating it 
to django's ORM framework ?

> 
> orig.lat = x
> orig.lon = y
> 
> "SELECT  destination.*,
> 3956 * 2 * ASIN(SQRT(  POWER(SIN((orig.lat - dest.lat) * pi()/180 /
> 2), 2) +
> COS(orig.lat * pi()/180) *  COS(dest.lat * pi()/180) *
> POWER(SIN((orig.lon -dest.lon) * pi()/180 / 2), 2)  )) as
> distance
> FROM place as dest
> WHERE  dest.longitude
> BETWEEN lon1 and lon2
> AND dest.latitude
> BETWEEN lat1 and lat2
> "
> 
> the model which talks to database is called Place in my case.
> 
> Thank you all for the help,
> sanket
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 


Jonas Geiregat
jo...@geiregat.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.



need help with calling following complex query

2011-07-10 Thread sanket
Hey All,

I am quite new to Django and recently started using django for
developing a location based service.
In order to find the places in near by area I want to make following
mysql query. but I am not sure how should I translate it using django
models and managers.

orig.lat = x
orig.lon = y

"SELECT  destination.*,
3956 * 2 * ASIN(SQRT(  POWER(SIN((orig.lat - dest.lat) * pi()/180 /
2), 2) +
COS(orig.lat * pi()/180) *  COS(dest.lat * pi()/180) *
POWER(SIN((orig.lon -dest.lon) * pi()/180 / 2), 2)  )) as
distance
FROM place as dest
WHERE  dest.longitude
BETWEEN lon1 and lon2
AND dest.latitude
BETWEEN lat1 and lat2
"

the model which talks to database is called Place in my case.

Thank you all for the help,
sanket

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



Need help intercepting SQL

2011-07-10 Thread Eric B
Our web site uses Django 1.2.  We're adding a layer to our MySQL
database called dbShards for fragmentation (sharding).  I need to
prepend instructive SQL comments (/* ... */) to UPDATE statements in
certain situations.  What's the best way to intercept the raw SQL sent
to the database?

I've come up with a couple ideas, but feel they are too invasive and
that there must be a better way.

Here's an example:  If the following code ...

em = ExampleModel.objects.get( id = 1 )
em.fieldname = "example"
em.save()

Generated the following SQL:

UPDATE examplemodel SET fieldname = 'example' WHERE id = 1;

Then I'd want my intercept code to prepend a comment like this to the
update statement.

/* example comment */ UPDATE examplemodel SET fieldname = 'example'
WHERE id = 1;

Thanks,
Eric

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

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
On Sun, Jul 10, 2011 at 5:30 AM, leo  wrote:

>  hi, sax
> I downloaded the package and want to install is using normal way
> then I got error like this:
>
> D:\saxix-django-iadmin-ec7ad2a>setup.py install
> Traceback (most recent call last):
>   File "D:\saxix-django-iadmin-ec7ad2a\setup.py", line 44, in 
> version = ".".join(iadmin.__version__),
> TypeError: sequence item 0: expected string, int found
>

Oh jeez, looks like that release is broken.

Go to here: "D:\saxix-django-iadmin-ec7ad2a\setup.py", line 44

And replace this line:
version = ".".join(iadmin.__version__),

With this:
version = ".".join(map(lambda x: str(x), iadmin.__version__)),

(the above just basically recasts the values in that list as string objects,
rather than ints. I suspect this was caused by the string not having a dot
or something)

Let me know if that works.

Cal


>
> I got confused because the package install procedure is different
> with online's manual...
>
>
>
>
> On 2011/7/5 3:26, sax wrote:
>
> yep, but more test needed
>
> sax
>
>
>
> 2011/7/4 Fred Chevitarese 
>
>> Hmmm I like it !
>>
>>  All those features are already working?
>>
>>
>>  ^^
>>
>>
>>  "
>> *O relógio da vida recebe corda apenas uma vez.*
>> *Ninguém tem o poder de decidir quando os ponteiros pararão, se mais cedo
>> ou se mais tarde.*
>> *O presente é o único tempo que você possui.*
>> *Viva, ame e trabalhe com vontade.*
>>  *Não ponha nenhuma esperança no tempo, pois o relógio pode parar a
>> qualquer momento.*
>> "
>>
>>  Fred Chevitarese - GNU/Linux
>> http://chevitarese.wordpress.com
>>
>>
>>
>>
>>
>>  2011/7/4 creecode 
>>
>>> Sounds interesting!  Thanks!
>>>
>>>
>>> On Monday, July 4, 2011 11:06:44 AM UTC-7, sax wrote:

 Django iAdmin

 iAdmin is a replacement of standard django admin application.
 Features

- multiple columns portlets-like home page
- tabbed view of inlines
- mass updates functionality
- export to csv with options and formatting
- advanced import from csv with foreign key handling
- link to foreignkey edit page from changelist
(list_display_rel_links)
- filter by cell values (cell_filters)
- ajax autocomplete widgets for ForeignKey
- auto register missed modules.
- auto add fields not present in fieldset (add_undefined_fields)
- utilities ( tabular_factory)
- info page for packages and application version
- integrated file manager with upload/zip functionality
- WYSIWYG editor wymeditor
- shortcuts to configure django.contrib.* applications

   --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>>  To view this discussion on the web visit
>>> https://groups.google.com/d/msg/django-users/-/PCtWyR-jwVMJ.
>>>
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, 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.
>
>
> --
> chlin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread het.oosten
>
> Just so happens I'm learning Dutch at the moment, and was able to read a lot
> of the code ;p

I guess that was my luck :-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
On Sun, Jul 10, 2011 at 8:58 PM, het.oosten  wrote:

> Ye, I think this was the only option i didnt try :-)
>
> Thanks Cal and Shawn!
>
> In a previous i translated the Dutch into English, and mixed things
> up, making everything more confusing.
>

Just so happens I'm learning Dutch at the moment, and was able to read a lot
of the code ;p


> Rob
>
> On Jul 10, 9:40 pm, "Cal Leeming [Simplicity Media Ltd]"
>  wrote:
> > Nice, not often I come across code written in nederlands ;p
> >
> > Is this what you are looking for by any chance??
> >
> > {{plaatje.1.plaatjes_lijst}}
> >
> > On Sun, Jul 10, 2011 at 8:33 PM, het.oosten 
> wrote:
> > > One addition to the above, when i do:
> > >def __unicode__(self):
> > > return '' %
> > > (self.plaatje, self.alt)
> >
> > > I can call the single images in the template with {{plaatje.1}} etc
> > > I found out in this thread that it is not a good idea to "abuse"
> > > unicode for this
> >
> > > On Jul 10, 9:28 pm, "het.oosten"  wrote:
> > > > > have the variable image_list in your context which is a list, you
> can
> > > do
> > > > > this:
> >
> > > > > {{ image_list.0 }} and {{ image_list.1 }}
> >
> > > > This is what i tried, but the only way to show the images
> > > > is(plaatjes_lijst=image_list):
> > > > {% for x in plaatje %}
> > > > {{x.plaatjes_lijst|safe}}
> > > > {% endfor %}
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, 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.



Scaling to 30k requests (malcolm box blog)

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
Came across the following blog entries today, for those interested in this
sort of thing:

http://attentionshard.wordpress.com/2011/04/26/scaling-django-to-3-requests-per-second/

http://attentionshard.wordpress.com/2011/04/03/scaling-to-30k-two-level-caches/
Interesting approach. Although you'd have to be careful what context it was
used in (i.e. if your code is written under the assumption that the caching
server is atomic).

http://attentionshard.wordpress.com/2011/04/26/scaling-to-30k-tsung/
Never heard of tsung before, looks pretty nice. Will try it out for sure.

http://attentionshard.wordpress.com/2011/05/03/scaling-to-30k-haproxy-on-ec2/
Can't comment much on this, as we've never used haproxy.

The stack they have used is quite interesting. Although they are using
Apache w/ mod_wsgi (which tends to be a lot slower than using nginx with
uwsgi), they still seem to have got some decent performance out of it.

http://attentionshard.wordpress.com/2011/06/21/behind-the-scenes-using-cassandra-acunu-to-power-britains-got-talent/
Explains a bit of their usage of using Cassandra. Would be interesting to
see some benchmarks though.

Cal

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread het.oosten
Ye, I think this was the only option i didnt try :-)

Thanks Cal and Shawn!

In a previous i translated the Dutch into English, and mixed things
up, making everything more confusing.

Rob

On Jul 10, 9:40 pm, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> Nice, not often I come across code written in nederlands ;p
>
> Is this what you are looking for by any chance??
>
> {{plaatje.1.plaatjes_lijst}}
>
> On Sun, Jul 10, 2011 at 8:33 PM, het.oosten  wrote:
> > One addition to the above, when i do:
> >        def __unicode__(self):
> >                 return '' %
> > (self.plaatje, self.alt)
>
> > I can call the single images in the template with {{plaatje.1}} etc
> > I found out in this thread that it is not a good idea to "abuse"
> > unicode for this
>
> > On Jul 10, 9:28 pm, "het.oosten"  wrote:
> > > > have the variable image_list in your context which is a list, you can
> > do
> > > > this:
>
> > > > {{ image_list.0 }} and {{ image_list.1 }}
>
> > > This is what i tried, but the only way to show the images
> > > is(plaatjes_lijst=image_list):
> > > {% for x in plaatje %}
> > > {{x.plaatjes_lijst|safe}}
> > > {% endfor %}
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
Nice, not often I come across code written in nederlands ;p

Is this what you are looking for by any chance??

{{plaatje.1.plaatjes_lijst}}


On Sun, Jul 10, 2011 at 8:33 PM, het.oosten  wrote:

> One addition to the above, when i do:
>def __unicode__(self):
> return '' %
> (self.plaatje, self.alt)
>
> I can call the single images in the template with {{plaatje.1}} etc
> I found out in this thread that it is not a good idea to "abuse"
> unicode for this
>
> On Jul 10, 9:28 pm, "het.oosten"  wrote:
> > > have the variable image_list in your context which is a list, you can
> do
> > > this:
> >
> > > {{ image_list.0 }} and {{ image_list.1 }}
> >
> > This is what i tried, but the only way to show the images
> > is(plaatjes_lijst=image_list):
> > {% for x in plaatje %}
> > {{x.plaatjes_lijst|safe}}
> > {% endfor %}
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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.



Toggle boolean fields from a Queryset using F objects

2011-07-10 Thread vascop
I've tried these queries with these results:

queryset.update(done=not F('boolean'))
{'time': '0.001', 'sql': u'UPDATE "todo_item" SET "done" = True'}

queryset.update(done=(F('boolean')==False))
{'time': '0.001', 'sql': u'UPDATE "todo_item" SET "done" = False'}


What I would like is something like this:

queryset.update(done=F('done'))
{'time': '0.002', 'sql': u'UPDATE "todo_item" SET "done" =
"todo_item"."done"'}


But with

SET "done" = !"todo_item"."done"
to toggle the boolean value

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread het.oosten
One addition to the above, when i do:
def __unicode__(self):
return '' %
(self.plaatje, self.alt)

I can call the single images in the template with {{plaatje.1}} etc
I found out in this thread that it is not a good idea to "abuse"
unicode for this

On Jul 10, 9:28 pm, "het.oosten"  wrote:
> > have the variable image_list in your context which is a list, you can do
> > this:
>
> > {{ image_list.0 }} and {{ image_list.1 }}
>
> This is what i tried, but the only way to show the images
> is(plaatjes_lijst=image_list):
> {% for x in plaatje %}
> {{x.plaatjes_lijst|safe}}
> {% endfor %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Some thoughts on a package/stack compile system for easy distribution of webapps..

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
*Roberto: *my responses below!

*Everyone else: *Roberto has very kindly done some modifications to uwsgi to
get things moving. See below comments for more info :)

On Sun, Jul 10, 2011 at 6:57 PM, Roberto De Ioris  wrote:

>
> >>
> >
> > I'll pull the most recent code tomorrow, and have a play around :) Will
> > let
> > you know how far I get. I'm quite excited now :D
> >
> >
>
> Ok, i have extremely improved it:
>
> - a new parameters in buildconf is available
>
> embed_files =
>
> you can use it to attach all the files you want to the uwsgi binary.
>
> Example:
>
> embed_files = embedme.py,uwsgidecorators.py,uWSGI_logo.png
>
> (i suppose you are editing default.ini, so launch make)
>
> now you have your binary with a new group of symbols:
>
> # objdump -t uwsgi
>
> (if you do not know, objdump will print the information about a binary)
>
> The output will list all of the uWSGI functions plus 3 symbols for each
> embedded file:
>
> 08095378 g   .data    _binary_embedme_py_start
> 0809547d g   .data    _binary_embedme_py_end
> 0809547d g   .data  
>  _binary_uwsgidecorators_py_start
> 118d g   *ABS*  
>  _binary_uwsgidecorators_py_size
> 0105 g   *ABS*    _binary_embedme_py_size
> 0809660a g   .data  
>  _binary_uwsgidecorators_py_end
>

Nice, didn't know about that tool.


>
> (here i have embedded empedme.py and uwsgidecorators.py)
>
> As you see the name of the symbols is the name of the file (with dot
> replaced by _ ) prefixed with _binary_ and suffixed with _start/_end/_size
>

I assume _start / _end / _size are references to the address space (within
the binary) where these embedded binaries (in symbol form) are kept??

Is there any sort of restrictions on maximum allowed symbol size? (looked on
Google, but couldn't find anything)


>
> Now you can reference this data with all the uWSGI options taking file/path
>
> ex:
>
> uwsgi --socket :3031 --import sym://embedme_py --import
> sym://uwsgidecorators_py
>
> or
>
> uwsgi --ini sym://myfile_ini
>

Really like the "sym://" protocol reference, that will make CLI usage very
easy.


> and so on
>
> But the most important thing is that you can reference them from python
> too:
>
>
> import uwsgi
>
>1. print uwsgi.embedded_data('embedme_py')
>
>
Just had a look at http://projects.unbit.it/hg/uwsgi/rev/2cc21926d986, to
see how the embedded_data() extension works.. looks clean!


>
> I think all of the pieces are here, you now have to create a bootstrap.py
> script that will extend the import subsystem to take a whole zip blob
> (StringIO.StringIO(uwsgi.embedded_data('mydjangoapp_zip')) ), so that you
> can set the buildconf with
>
> embed_files = bootstrap.py,mydjangoapp.zip
> embed_config = myconfig.ini
>
> with myconfig.ini simply containing:
>
> [uwsgi]
> import = sym://bootstrap_py
> socket = :
> master = true
>

That looks pretty straight forward. The C code looks fairly simple to work
with too, so I might even be able to make some changes along the way.

I'll give this a real good thrashing tomorrow, and will let you know the
results.


> 
>
> I hope it is clear, feel free to move the discussion to the uwsgi list
> (obviously introduce to the others guy what you are trying to accomplish)
>

Once I've played with this tomorrow, I'll type up a full report on what I
did to get it working, suggested improvements etc, so others can play with
it. I'll also forward this to the mailing list to keep everyone updated.

Great work on this!! :)


>
> --
> Roberto De Ioris
> http://unbit.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: merge images into a webpage

2011-07-10 Thread het.oosten
> have the variable image_list in your context which is a list, you can do
> this:
>
> {{ image_list.0 }} and {{ image_list.1 }}

This is what i tried, but the only way to show the images
is(plaatjes_lijst=image_list):
{% for x in plaatje %}
{{x.plaatjes_lijst|safe}}
{% endfor %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread Shawn Milochik
You can easily do this in your template with an index. Assuming you'll 
have the variable image_list in your context which is a list, you can do 
this:


{{ image_list.0 }} and {{ image_list.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.



Re: my frist django project Error

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
On Sun, Jul 10, 2011 at 7:42 PM, Malcolm Box  wrote:

> Cal,
>
> You are contributing a lot to the django users group, but this response
> isnt in the best spirit of the group.
>
> Yes, the op could work out from the traceback what the error was, but we
> were all beginners once. If you compare this post to the how to post FAQ its
> not too bad - at least there's a traceback.
>
> Telling someone they need to learn more python isn't helpful - tell them
> that theres a setting missing and how the traceback makes that clear.
>

That's a fair point tbh.

I'll make sure to use a more friendly approach for future threads like this.
:)


>
> Sorry to pull you up on this but the helpfulness of this list is important
> both to me and the health of the django community.
>

> Malcolm
>
>
> Sent from my iPhone, please excuse any typos
>
> On 9 Jul 2011, at 21:49, "Cal Leeming [Simplicity Media Ltd]"<
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
> Question, have you ever used Python before?
>
> If no, then I suggest you learn Python before jumping into Django.
>
> If yes, then you need to learn more about Python.
>
> Cal
>
> On Sat, Jul 9, 2011 at 9:21 PM, morning yao < 
> yitai...@gmail.com> wrote:
>
>> so ,here is the Error Traceback,i need your help,thanks!
>> ___
>> Environment:
>>
>>
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/
>>
>> Django Version: 1.3
>> Python Version: 2.7.2
>> Installed Applications:
>> ['django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.sites',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'django.contrib.admin']
>> Installed Middleware:
>> ('django.middleware.common.CommonMiddleware',
>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware')
>>
>>
>> Traceback:
>> File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in
>> get_response
>>  101. request.path_info)
>> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
>> resolve
>>  250. for pattern in self.url_patterns:
>> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
>> _get_url_patterns
>>  279. patterns = getattr(self.urlconf_module, "urlpatterns",
>> self.urlconf_module)
>> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
>> _get_urlconf_module
>>  274. self._urlconf_module =
>> import_module(self.urlconf_name)
>> File "C:\Python27\lib\site-packages\django\utils\importlib.py" in
>> import_module
>>  35. __import__(name)
>> File "C:\Python27\Lib\site-packages\django\dinette\..\dinette\urls.py"
>> in 
>>  4. from dinette.views import
>> LatestTopicsByCategory,LatestRepliesOfTopic
>> File "C:\Python27\Lib\site-packages\django\dinette\..\dinette
>> \views.py" in 
>>  19. from dinette.models import Ftopics ,
>> SuperCategory ,Category ,Reply, DinetteUserProfile
>> File "C:\Python27\Lib\site-packages\django\dinette\..\dinette
>> \models.py" in 
>>  18.
>>
>> logging.config.fileConfig(settings.LOG_FILE_NAME,defaults=dict(log_path=settings.LOG_FILE_PATH))
>> File "C:\Python27\lib\site-packages\django\utils\functional.py" in
>> __getattr__
>>  277. return getattr(self._wrapped, name)
>>
>> Exception Type: AttributeError at /
>> Exception Value: 'Settings' object has no attribute 'LOG_FILE_NAME'
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to 
>> django-users@googlegroups.com.
>> To unsubscribe from this group, 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To 

Re: my frist django project Error

2011-07-10 Thread Malcolm Box
Cal,

You are contributing a lot to the django users group, but this response isnt in 
the best spirit of the group. 

Yes, the op could work out from the traceback what the error was, but we were 
all beginners once. If you compare this post to the how to post FAQ its not too 
bad - at least there's a traceback. 

Telling someone they need to learn more python isn't helpful - tell them that 
theres a setting missing and how the traceback makes that clear. 

Sorry to pull you up on this but the helpfulness of this list is important both 
to me and the health of the django community. 

Malcolm


Sent from my iPhone, please excuse any typos

On 9 Jul 2011, at 21:49, "Cal Leeming [Simplicity Media 
Ltd]" wrote:

> Question, have you ever used Python before?
> 
> If no, then I suggest you learn Python before jumping into Django.
> 
> If yes, then you need to learn more about Python.
> 
> Cal
> 
> On Sat, Jul 9, 2011 at 9:21 PM, morning yao  wrote:
> so ,here is the Error Traceback,i need your help,thanks!
> ___
> Environment:
> 
> 
> Request Method: GET
> Request URL: http://127.0.0.1:8000/
> 
> Django Version: 1.3
> Python Version: 2.7.2
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'django.contrib.admin']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware')
> 
> 
> Traceback:
> File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in
> get_response
>  101. request.path_info)
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
> resolve
>  250. for pattern in self.url_patterns:
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
> _get_url_patterns
>  279. patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module)
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
> _get_urlconf_module
>  274. self._urlconf_module =
> import_module(self.urlconf_name)
> File "C:\Python27\lib\site-packages\django\utils\importlib.py" in
> import_module
>  35. __import__(name)
> File "C:\Python27\Lib\site-packages\django\dinette\..\dinette\urls.py"
> in 
>  4. from dinette.views import
> LatestTopicsByCategory,LatestRepliesOfTopic
> File "C:\Python27\Lib\site-packages\django\dinette\..\dinette
> \views.py" in 
>  19. from dinette.models import Ftopics ,
> SuperCategory ,Category ,Reply, DinetteUserProfile
> File "C:\Python27\Lib\site-packages\django\dinette\..\dinette
> \models.py" in 
>  18.
> logging.config.fileConfig(settings.LOG_FILE_NAME,defaults=dict(log_path=settings.LOG_FILE_PATH))
> File "C:\Python27\lib\site-packages\django\utils\functional.py" in
> __getattr__
>  277. return getattr(self._wrapped, name)
> 
> Exception Type: AttributeError at /
> Exception Value: 'Settings' object has no attribute 'LOG_FILE_NAME'
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread het.oosten
Here is the link to pastebin:
http://pastebin.com/1FuVH7Hu

It is all about getting specific content for a season a user chooses
(it is a site for a campground)

If you need more info, i will be happy to provide.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
On Sun, Jul 10, 2011 at 6:26 PM, het.oosten  wrote:

> Ok perhaps a basic question. I wrote a custom method for my model:
>def image_list(self):
>return '' %
> (self.image, self.alt)
>

You should never really put HTML inside a method unless you *really* have to
(even if it's for performance, unless your site is getting thousands and
thousands of hits a minute, then just use a template)


> And i indeed get a nice list of image in the template. I want however
> control where the single images show up. With something like {{image.
> 1}} other text {{image.2}} in the text.
>

I'm a bit confused as to how you are getting the image list in the first
place, you'll need to paste your code. (use dpaste or pastebin please).


>
> How do i accomplist this?
>
> On Jul 10, 5:54 pm, Shawn Milochik  wrote:
> > I'd rather see the contents of your __unicode__ function as a
> > get_absolute_url function, with the __unicode__ maybe returning just the
> > filename or the parent object's title and the filename.
>
>
> > I strongly dislike the embedding of template code in a text field of
> > your model, because it makes maintenance a lot harder. I don't know what
> > your code looks like that reads and writes that, so maybe it works for
> > you. In any case, have a look at adding a method or property to your
> > model that returns an iterable of image links. I think it'll be a lot
> > easier to maintain in the long run.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread het.oosten
Ok perhaps a basic question. I wrote a custom method for my model:
def image_list(self):
return '' %
(self.image, self.alt)
And i indeed get a nice list of image in the template. I want however
control where the single images show up. With something like {{image.
1}} other text {{image.2}} in the text.

How do i accomplist this?

On Jul 10, 5:54 pm, Shawn Milochik  wrote:
> I'd rather see the contents of your __unicode__ function as a
> get_absolute_url function, with the __unicode__ maybe returning just the
> filename or the parent object's title and the filename.
>
> I strongly dislike the embedding of template code in a text field of
> your model, because it makes maintenance a lot harder. I don't know what
> your code looks like that reads and writes that, so maybe it works for
> you. In any case, have a look at adding a method or property to your
> model that returns an iterable of image links. I think it'll be a lot
> easier to maintain in the long run.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread Shawn Milochik

On 07/10/2011 12:28 PM, het.oosten wrote:

Adding a method/property to my model is a thing i haven't considered.
You have a good point there. I will do some more reading to find a
solution in this direction. Thanks!

Rob


It's easy to forget that Django is just Python. You're the programmer, 
so if you want to add a method then go ahead. It's best to understand 
Django's design as well as possible before you go adding things because 
sometimes things are done for a good reason.


But in the end, you're the developer responsible for delivering a 
working product, so do what you have to do.



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread het.oosten
Adding a method/property to my model is a thing i haven't considered.
You have a good point there. I will do some more reading to find a
solution in this direction. Thanks!

Rob

On Jul 10, 5:54 pm, Shawn Milochik  wrote:
> I'd rather see the contents of your __unicode__ function as a
> get_absolute_url function, with the __unicode__ maybe returning just the
> filename or the parent object's title and the filename.
>
> I strongly dislike the embedding of template code in a text field of
> your model, because it makes maintenance a lot harder. I don't know what
> your code looks like that reads and writes that, so maybe it works for
> you. In any case, have a look at adding a method or property to your
> model that returns an iterable of image links. I think it'll be a lot
> easier to maintain in the long run.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: 'WSGIRequest' object has no attribute 'update'

2011-07-10 Thread Shawn Milochik
May we see the rest of your view? If not, you'll have to figure it out 
by examining exactly what your 'request' variable contains. The error is 
clearly from calling update() on it, and it not being allowed.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread Shawn Milochik
I'd rather see the contents of your __unicode__ function as a 
get_absolute_url function, with the __unicode__ maybe returning just the 
filename or the parent object's title and the filename.


I strongly dislike the embedding of template code in a text field of 
your model, because it makes maintenance a lot harder. I don't know what 
your code looks like that reads and writes that, so maybe it works for 
you. In any case, have a look at adding a method or property to your 
model that returns an iterable of image links. I think it'll be a lot 
easier to maintain in the long run.



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

2011-07-10 Thread Shawn Milochik
I don't know what your models and form look like so I can't say exactly. 
However, you probably need to just modify one of your clean functions so 
it retains multiple values, and update your save function to do the 
right thing when it gets more than one.


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



Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
How about this..

---
Asking question about Python related subjects is fine as long as;

* You follow the same guidelines as the rest of this document
* The question itself is somehow vaguely related to your Django project
* You understand that learning Django will involve learning Python as well.

For those who would like to read some tutorials on the basics of Python, you
could try:
http://wiki.python.org/moin/BeginnersGuide/Programmers

---

On Sun, Jul 10, 2011 at 4:40 PM, Venkatraman S  wrote:

> Actually, i thought about this a little more...as Brian has suggested, we
> shouldnt shun away 'prospective' pythonistas.
> Probably, we can keep the tone a little friendly...
>
> --
>
> Do you have *any* experience at all using Python, or understand the basic
> concepts of how Python work?
> If not, probably you can spend some time learning the basics; this would
> help you a lot when you get on speed with Django.
>
>
> If not, please refer to the following before attempting to use Django:
> http://wiki.python.org/moin/BeginnersGuide/Programmers
>
> If you are clueless, then you all the more welcome to the community :)
>
> 
>
> -V
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
On Sun, Jul 10, 2011 at 3:01 PM, Brian Bouterse  wrote:

> +1 for this write up.
>
> Not that your write up suggests this, but I am cautious to turn folks away
> from django-users because they ask a python only question.  From a venn
> diagram perspective the django community is a subset of the python
> community.  Using Django to teach folks more about Python is a win for
> everyone (django, python, open source, ...).  My personal heuristic on what
> is off topic on django-users for python specific questions is this:  if the
> question is python only, if it is ultimately going to be used in a django
> project, then I consider that on topic.
>

That sounds fair.

I think this clause would be mostly aimed at newcomers who are expecting
they can use Django, without having to learn Python (for example, asking
questions about Python which are easily answered on Google).


>
> Brian
>
>
> On Sun, Jul 10, 2011 at 9:45 AM, Venkatraman S  wrote:
>
>> +1 from me.
>> (but i see some in IRC who do not know python but start learning it along
>> with Django - so probably we need not be too strict about this clause?)
>>
>
Yeah this is a tricky one. Perhaps the same 'intuition/laziness' rules
currently listed on the wiki page should apply, maybe? I.e. asking python
questions is fine, as long as you follow the guidelines as shown in that
page..?


>
>> -V
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Brian Bouterse
> ITng Services
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-10 Thread Venkatraman S
Actually, i thought about this a little more...as Brian has suggested, we
shouldnt shun away 'prospective' pythonistas.
Probably, we can keep the tone a little friendly...

--
Do you have *any* experience at all using Python, or understand the basic
concepts of how Python work?
If not, probably you can spend some time learning the basics; this would
help you a lot when you get on speed with Django.

If not, please refer to the following before attempting to use Django:
http://wiki.python.org/moin/BeginnersGuide/Programmers

If you are clueless, then you all the more welcome to the community :)



-V

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

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
Nice, are you thinking of using something like Sphinx SE for the search
engine??

Sadly, with all the extra projects I'm working on atm, it would just sit in
my todo list for at least 3-6 months :(

Cal

On Sun, Jul 10, 2011 at 3:59 PM, Jacob Kaplan-Moss wrote:

> On Sat, Jul 9, 2011 at 8:01 AM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
> > Hmm, some concerns:
>
> Luckily, it's open source: https://github.com/django/djangoproject.com
> -- patches welcome!
>
> [If you want to add search to the community aggregator that'd make me
> very happy; it's been on my todo list for ages...]
>
> Jacob
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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 Knowledge Strorehouse

2011-07-10 Thread Jacob Kaplan-Moss
On Sat, Jul 9, 2011 at 8:01 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Hmm, some concerns:

Luckily, it's open source: https://github.com/django/djangoproject.com
-- patches welcome!

[If you want to add search to the community aggregator that'd make me
very happy; it's been on my todo list for ages...]

Jacob

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



Form wizard get_template_names()

2011-07-10 Thread Dario Vergara
Hi,

I am using the development version of FormWizard. The documentation
says that you can change the default template name by overriding
get_template_names(). My implementation seems to always return the
same template:

class MyWizard(SessionWizardView):

def done(self, form_list, **kwargs):
return render_to_response('done.html', {
'form_data': [form.cleaned_data for form in form_list],
})

def get_template_names(self):
return ['./mysite/step_1.html','./mysite/step_2.html']


Any idea on how to make the template change to step_2 after the user
clicks next on step 1?

The documentation on how to implement this method is missing from
https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-10 Thread Brian Bouterse
+1 for this write up.

Not that your write up suggests this, but I am cautious to turn folks away
from django-users because they ask a python only question.  From a venn
diagram perspective the django community is a subset of the python
community.  Using Django to teach folks more about Python is a win for
everyone (django, python, open source, ...).  My personal heuristic on what
is off topic on django-users for python specific questions is this:  if the
question is python only, if it is ultimately going to be used in a django
project, then I consider that on topic.

Brian


On Sun, Jul 10, 2011 at 9:45 AM, Venkatraman S  wrote:

> +1 from me.
> (but i see some in IRC who do not know python but start learning it along
> with Django - so probably we need not be too strict about this clause?)
>
> -V
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: http auth using django auth_user table

2011-07-10 Thread Ali Rıza KELEŞ
2011/7/10 Cal Leeming [Simplicity Media Ltd]
:
> The only connection this question has with Django, is the encryption method
> that Django uses, and therefore is inappropriate for this forum.

Yes, right. It had seemed me connected. Sorry for wasting your time..

> Please refer to http://code.djangoproject.com/wiki/UsingTheMailingList

Thanks..

> On a site note, it took me less than 10 seconds on Google (with a very
> simple search term - first result) to find the answer you needed, which
> shows either lack of intuition or total laziness on your part.

Thanks again.. I looked for an experience..

--
Ali

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-10 Thread Venkatraman S
+1 from me.
(but i see some in IRC who do not know python but start learning it along
with Django - so probably we need not be too strict about this clause?)

-V

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



(UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
We don't seem to have a policy of dealing with mailing list posts in which
the user clearly has no Python experience.

Therefore, I'd like to hear some thoughts on making an amendment to
UsingTheMailingList,
which states:

"""
Do you have *any* experience at all using Python, or understand the basic
concepts of how Python work?

If not, please refer to the following before attempting to use Django:
http://wiki.python.org/moin/BeginnersGuide/Programmers

"""

This would be just the same principle if someone wanted to learn, say
"CodeIgniter", but without having to learn PHP. It's just not gonna fly,
right?

Cal

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: http auth using django auth_user table

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
The only connection this question has with Django, is the encryption method
that Django uses, and therefore is inappropriate for this forum.

Please refer to http://code.djangoproject.com/wiki/UsingTheMailingList

On a site note, it took me less than 10 seconds on Google (with a very
simple search term - first result) to find the answer you needed, which
shows either lack of intuition or total laziness on your part.

Cal


On Sun, Jul 10, 2011 at 1:45 PM, Ali Rıza KELEŞ wrote:

> Hi,
>
> I want to use django auth_user table for authentication of another
> application which uses "apache basic auth" with module auth_mysql. The
> code below runs well with MD5 passwords without salt. But django works
> sha1 and with salt.
>
> What should I do?
>
> Thanks..
>
> AuthName "Hi.. Please login"
> AuthType Basic
> AuthBasicAuthoritative Off
> Auth_MySQL On
> Auth_MySQL_Authoritative on
> Auth_MySQL_Host localhost
>
> Auth_MySQL_User django-mysql-user
> Auth_MySQL_Password some-password
> Auth_MySQL_DB django-mysql-database
> Auth_MySQL_Password_Table auth_user
>
> Auth_MySQL_Empty_Passwords Off
> Auth_MySQL_Encrypted_Passwords on
>
>
> Auth_MySQL_Username_Field email
> Auth_MySQL_Password_Field password
> Auth_MySQL_Encryption_Types PHP_MD5
>
> AuthUserFile /dev/null
>
> Require valid-user
>
>
> --
> --
> Ali Rıza Keleş
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: Manytoone Form

2011-07-10 Thread Magrelo
Thanks Shawn, I've done this, the only problem now is if I select only
one field the override save method works fine, but if I select more
than one, the field comes empty on the save method.

Any tips?

Thanks again!

Thiago

On Jul 8, 12:12 pm, Shawn Milochik  wrote:
> Add the field in your ModelForm, just as you would with a form. You're
> allowed to do that.
>
> Override the __init__ of your ModelForm subclass and populate the choices.
>
> Override the clean and clean_field functions (if necessary).
>
> Override the save() to populate the field in the other model from your
> custom field.

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



http auth using django auth_user table

2011-07-10 Thread Ali Rıza KELEŞ
Hi,

I want to use django auth_user table for authentication of another
application which uses "apache basic auth" with module auth_mysql. The
code below runs well with MD5 passwords without salt. But django works
sha1 and with salt.

What should I do?

Thanks..

AuthName "Hi.. Please login"
AuthType Basic
AuthBasicAuthoritative Off
Auth_MySQL On
Auth_MySQL_Authoritative on
Auth_MySQL_Host localhost

Auth_MySQL_User django-mysql-user
Auth_MySQL_Password some-password
Auth_MySQL_DB django-mysql-database
Auth_MySQL_Password_Table auth_user

Auth_MySQL_Empty_Passwords Off
Auth_MySQL_Encrypted_Passwords on


Auth_MySQL_Username_Field email
Auth_MySQL_Password_Field password
Auth_MySQL_Encryption_Types PHP_MD5

AuthUserFile /dev/null

Require valid-user


-- 
--
Ali Rıza Keleş

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



'WSGIRequest' object has no attribute 'update'

2011-07-10 Thread Phang Mulianto
Hi all..i am learning django no, using django 1.3 + python 2.7 . i came from
php world...

i am using a book , and follow the code in there, but got error and cannot
find whats the cause. here are the errors.

anyone can give some clue? Thanks
AttributeError at /cart/

'WSGIRequest' object has no attribute 'update'

 Request Method: GET  Request URL: http://127.0.0.1:8000/cart/  Django
Version: 1.3  Exception Type: AttributeError  Exception Value:

'WSGIRequest' object has no attribute 'update'

 Exception Location: c:\python27\lib\site-packages\django\template\loader.py
in render_to_string, line 186  Python Executable:
c:\python27\python.exe  Python
Version: 2.7.2  Python Path:

['C:\\Users\\mulianto\\workspace\\ecomstore\\src\\ecomstore',
 'c:\\python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg',
 'C:\\Windows\\system32\\python27.zip',
 'c:\\python27\\DLLs',
 'c:\\python27\\lib',
 'c:\\python27\\lib\\plat-win',
 'c:\\python27\\lib\\lib-tk',
 'c:\\python27',
 'c:\\python27\\lib\\site-packages']

 Server time: Sun, 10 Jul 2011 13:23:33 +0800
Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/cart/

Django Version: 1.3
Python Version: 2.7.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.flatpages',
 'ecomstore.catalog',
 'ecomstore.utils',
 'ecomstore.cart']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')


Traceback:
File "c:\python27\lib\site-packages\django\core\handlers\base.py" in
get_response
  111. response = callback(request, *callback_args,
**callback_kwargs)
File
"C:\Users\mulianto\workspace\ecomstore\src\ecomstore\..\ecomstore\cart\views.py"
in show_cart
  17. return render_to_response(template_name, locals(),
context_instance=(request))
File "c:\python27\lib\site-packages\django\shortcuts\__init__.py" in
render_to_response
  20. return HttpResponse(loader.render_to_string(*args, **kwargs),
**httpresponse_kwargs)
File "c:\python27\lib\site-packages\django\template\loader.py" in
render_to_string
  186. context_instance.update(dictionary)

Exception Type: AttributeError at /cart/
Exception Value: 'WSGIRequest' object has no attribute 'update'

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Extending User model with Inheritance - Attribute Error

2011-07-10 Thread Jonas Geiregat

Op 10-jul-2011, om 12:37 heeft Venkatraman S het volgende geschreven:

> 
> This is not good design. If you want to store some extra fields for a User - 
> i would define just another model called ProfileDetails, FK it to User and 
> use it as such.

That's also how I would do it, some example code to make it even more clear:

from django.db import models
from django.contrib.auth.models import User

class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
url = models.URLField("Website", blank=True)
company = models.CharField(max_length=50, blank=True)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread het.oosten
Oops i posted too fastis there a better way to accomplish the
above?

On Jul 10, 12:41 pm, "het.oosten"  wrote:
> I got is working like this:
>
> In my model:
>         titel = models.CharField(max_length=200)
>         alt = models.CharField(max_length=200)
>         plaatje = models.ImageField(upload_to='plaatjes/')
>         menu = models.ForeignKey(Menu)
>         seizoenen = models.ManyToManyField(Seizoenen)
>         def __unicode__(self):
>                 return '' % (self.plaatje,
> self.alt)
>
> In my view:
> content_tekst = Tekst.objects.filter(menu__slug__iexact=seizoen)[:1]
>         content_images =
> Images.objects.filter(menu__slug__iexact=seizoen)
>         from django.template import Context, Template
>         for x in content_text:
>                 t = Template(x.text)
>                 c = Context({"image": content_images})
>                 y = t.render(c)
>
> In the text i store in the database (content_text):
> text
> {{ image.0| safe}}
> more text
> {{ image.1|safe}}
>
> Finally I render y in an existing template with a RequestContext

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: merge images into a webpage

2011-07-10 Thread het.oosten
I got is working like this:

In my model:
titel = models.CharField(max_length=200)
alt = models.CharField(max_length=200)
plaatje = models.ImageField(upload_to='plaatjes/')
menu = models.ForeignKey(Menu)
seizoenen = models.ManyToManyField(Seizoenen)
def __unicode__(self):
return '' % (self.plaatje,
self.alt)

In my view:
content_tekst = Tekst.objects.filter(menu__slug__iexact=seizoen)[:1]
content_images =
Images.objects.filter(menu__slug__iexact=seizoen)
from django.template import Context, Template
for x in content_text:
t = Template(x.text)
c = Context({"image": content_images})
y = t.render(c)

In the text i store in the database (content_text):
text
{{ image.0| safe}}
more text
{{ image.1|safe}}

Finally I render y in an existing template with a RequestContext

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Extending User model with Inheritance - Attribute Error

2011-07-10 Thread Venkatraman S
On Sun, Jul 10, 2011 at 1:05 PM, Brent  wrote:

> Hi all,
>
> I am attempting to follow this tutorial:
>
> http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/
>
> But I am receiving this error:
> AttributeError at /login/
> 'NoneType' object has no attribute 'DoesNotExist'
>
> Here is my stack trace:
> http://dpaste.com/565795/
>
> I tried changing the CUSTOM_USER_MODEL field to every permutation of
> paths that could possibly lead to my CustomUser class, but they all
> gave the same error.
>


This is not good design. If you want to store some extra fields for a User -
i would define just another model called ProfileDetails, FK it to User and
use it as such.

Btw, i somehow never liked model-subclassing; but i come from a rdbms
background.

-V

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



Extending User model with Inheritance - Attribute Error

2011-07-10 Thread Brent
Hi all,

I am attempting to follow this tutorial:
http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/

But I am receiving this error:
AttributeError at /login/
'NoneType' object has no attribute 'DoesNotExist'

Here is my stack trace:
http://dpaste.com/565795/

I tried changing the CUSTOM_USER_MODEL field to every permutation of
paths that could possibly lead to my CustomUser class, but they all
gave the same error.

Thanks in advance.

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