Re: Can anyone give me a suggestion or a recommendation as to how I can access the current user's username in the models.py?

2013-03-14 Thread Russell Keith-Magee
On Fri, Mar 15, 2013 at 11:58 AM, Mike Dewhirst wrote:

> On 15/03/2013 10:31am, Russell Keith-Magee wrote:
>
>>
>>
>> On Fri, Mar 15, 2013 at 5:24 AM, Shawn Milochik > > wrote:
>>
>> I've repeatedly asked about this over the past couple of years and
>> there seems to be no "right" answer." This, to me, is the biggest flaw
>> in Django.
>>
>>
>> There's definitely a right answer.
>>
>
> Russell
>
> What is the right way to design a system whereby on every save for every
> model the updated_by column is changed to the user.id of the logged-in
> user? This has to happen whether updates are done via views or the
> Django-Admin.
>
> And I'm saying anonymous users can't update at all.
>
> The brief version?

class MyModel(Model):
   ...
   def save(self, user, *args, **kwargs):
   self.updated_by = user
   return super(MyModel, self).save(*args, **kwargs)

>From there, you just need to follow that path back to the place where the
model is saved by the form. All the admin save handlers have access to the
request, from which you can extract the user; form construction in the
admin is also abstracted behind an interface, so you can modify the
arguments passed to the form at time of construction; and forms can be
modified to pass down the user data as needed to the call to save().

Now - I'm not for a second claiming that this is something that Django does
well -- but it *can* be done (I know, because I've done it).

And, more to the point, I'd look very sympathetically on any proposal or
patch that made it easier to do this sort of thing -- a lot more
sympathetically than I would on saying "This is hard, lets go shopping and
use lots of global variables".

Yours,
Russ Magee %-)

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




Re: resize modelform fields on template

2013-03-14 Thread Mike Dewhirst

On 15/03/2013 4:25pm, Mike Dewhirst wrote:

On 15/03/2013 11:05am, cabrazil wrote:

Hi,

I have the same problem. Have you recieved any help?
Thanks.

Em segunda-feira, 3 de setembro de 2012 07h09min22s UTC-3, mapapage
escreveu:

Hi all!
I'd like to know if there's a way to resize my modelform fields on
the template. They're being rendered too big for the text input.
I tried this :

   name  =  forms.CharField(
widget=forms.TextInput(attrs={'size':'40'}))

but it didn't work.



Try this in your css ...

.field- .vLargeTextField {
 width: 40px !important;
 height: 40px;
}


or for all TextField ...

.vLargeTextField {
width: 40em !important;
height: 40px;
}

or all ordinary CharField ...

.vTextField {
width: 30em !important;
height: 40px;
}

I haven't played with the widgets but the docs will possibly tell you 
the attributes are rows and cols rather than size.


Mike







I also changed the width in css but unsuccessfully.

Do you have any solution to suggest?

Thx!

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






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




Re: resize modelform fields on template

2013-03-14 Thread Mike Dewhirst

On 15/03/2013 11:05am, cabrazil wrote:

Hi,

I have the same problem. Have you recieved any help?
Thanks.

Em segunda-feira, 3 de setembro de 2012 07h09min22s UTC-3, mapapage
escreveu:

Hi all!
I'd like to know if there's a way to resize my modelform fields on
the template. They're being rendered too big for the text input.
I tried this :

   name  =  forms.CharField(
widget=forms.TextInput(attrs={'size':'40'}))

but it didn't work.



Try this in your css ...

.field- .vLargeTextField {
width: 40px !important;
height: 40px;
}





I also changed the width in css but unsuccessfully.

Do you have any solution to suggest?

Thx!

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




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




"condition_dict" and "get_cleaned_data_for_step" triggers multiple queries in FormWizard

2013-03-14 Thread Einsiedlerkrebs
Hi,

I made a FormWizard with Django 1.4 according to the 
FormWizard-documentationwith
 
*different templates for each form* and *Conditionally view*. 
It works, but I found a problem with the *Conditionally view*. The 
condition callable triggers, (like *show_message_form_condition()* from the 
documentation) *get_cleaned_data_for_step* and this triggers seven times  *
get_form_kwargs()*
If there is a query in the form, the same querie hits seven times the 
datebase because of *get_form_kwargs()

*Is this a bug in Django with get_cleaned_data_for_step?

I need your help. :(

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




Re: resize modelform fields on template

2013-03-14 Thread cabrazil
Hi,

I have the same problem. Have you recieved any help? 
Thanks.

Em segunda-feira, 3 de setembro de 2012 07h09min22s UTC-3, mapapage 
escreveu:
>
> Hi all!
> I'd like to know if there's a way to resize my modelform fields on the 
> template. They're being rendered too big for the text input.
> I tried this :
>
>   name = forms.CharField(
>widget=forms.TextInput(attrs={'size':'40'}))
>
> but it didn't work.
>
> I also changed the width in css but unsuccessfully.
>
> Do you have any solution to suggest?
>
> Thx!
>
>

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




Re: Can anyone give me a suggestion or a recommendation as to how I can access the current user's username in the models.py?

2013-03-14 Thread Mike Dewhirst

On 15/03/2013 10:31am, Russell Keith-Magee wrote:



On Fri, Mar 15, 2013 at 5:24 AM, Shawn Milochik mailto:sh...@milochik.com>> wrote:

I've repeatedly asked about this over the past couple of years and
there seems to be no "right" answer." This, to me, is the biggest flaw
in Django.


There's definitely a right answer.


Russell

What is the right way to design a system whereby on every save for every 
model the updated_by column is changed to the user.id of the logged-in 
user? This has to happen whether updates are done via views or the 
Django-Admin.


And I'm saying anonymous users can't update at all.

I actually got this working some months ago using Marty Alchin's 
CurrentUserField from his Pro Django. It was a bit complex for my level 
of competence and I took it out as part of a simplification exercise 
when I was debugging something diabolical and didn't put it back for 
another reason but that's another story.


Thanks

Mike




The official (and useless) answer is that you must pass "user" in
everywhere you save anything. This is stupid, obviously, because you
can not rewrite every third-party app to support this (among other
reasons).


Can someone please explain to my why it is "stupid" that a function
should accept as an argument everything that it needs to perform it's
job? This is basic algorithm design, not black magic.

I'm utterly amazed that for some reason, when it comes to web
programming, global variables have somehow become acceptable. Because
that's what a thread local is - a global variable.

I can't speak for anyone else, but my first year university curriculum
pointed out why global variables shouldn't be used. 20-odd years of
software development experience has reinforced this understanding.

Django itself uses thread locals in a couple of internal components, and
let me tell you from experience -- every single one of them causes a
world of hurt when you start trying to debug edge cases, or when you're
trying to implement tests of functionality. If my time machine was
working, I'd be jumping back in time to purge every last use of thread
locals from Django's codebase.

There was a good tutorial for using threadlocals on the
official Django wiki but someone deleted it in a fit of spite a few
years ago.


No - there was *a* tutorial several years ago, and it was deleted
because members of the core team got tired of jumping into every
conversation where it was referenced to chime in, yet again, that it was
bad practice, with a whole bunch of potential security implications.

Fixing these problems the right way requires some planning. But for me,
"it's harder to do this properly" isn't a compelling reason to bugger up
your system architecture.

If a third party app doesn't provide a way to pass in the user object,
then *fix the damn third party app*. This is open source, after all, and
an inability to pass in relevant parameters to an operation is a bug (or
at least a missing feature).

And if there's somewhere that Django doesn't do a good job about making
it easy to pass around relevant parameters, *suggest an improvement*. I
can think of a couple of places in the forms library where there is
obvious room for improvement (possible to work around at present, but
not as elegant as a baked-in solution).

Yours,
Russ Magee %-)

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




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




Re: How to deal with No handlers could be found for logger "XXX"?

2013-03-14 Thread askpython
Thank you!

在 2013年3月14日星期四UTC+9上午11时58分23秒,jondbaker写道:
>
> This example in the django docs demonstrates how to configure logging 
> handlers within your settings.py: 
> https://docs.djangoproject.com/en/dev/topics/logging/#an-example
>
> On Wed, Mar 13, 2013 at 8:50 PM, > wrote:
>
>> As title,when I run my program.I see a message form console as it:
>>
>> No handlers could be found for logger "XXX"
>>
>> "XXX" is my source name of program.
>>
>> How to set the settings.py to deal with it?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Jonathan D. Baker
> Developer
> http://jonathandbaker.com
>

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




Re: Can anyone give me a suggestion or a recommendation as to how I can access the current user's username in the models.py?

2013-03-14 Thread Russell Keith-Magee
On Fri, Mar 15, 2013 at 5:24 AM, Shawn Milochik  wrote:

> I've repeatedly asked about this over the past couple of years and
> there seems to be no "right" answer." This, to me, is the biggest flaw
> in Django.
>

There's definitely a right answer.


> The official (and useless) answer is that you must pass "user" in
> everywhere you save anything. This is stupid, obviously, because you
> can not rewrite every third-party app to support this (among other
> reasons).


Can someone please explain to my why it is "stupid" that a function should
accept as an argument everything that it needs to perform it's job? This is
basic algorithm design, not black magic.

I'm utterly amazed that for some reason, when it comes to web programming,
global variables have somehow become acceptable. Because that's what a
thread local is - a global variable.

I can't speak for anyone else, but my first year university curriculum
pointed out why global variables shouldn't be used. 20-odd years of
software development experience has reinforced this understanding.

Django itself uses thread locals in a couple of internal components, and
let me tell you from experience -- every single one of them causes a world
of hurt when you start trying to debug edge cases, or when you're trying to
implement tests of functionality. If my time machine was working, I'd be
jumping back in time to purge every last use of thread locals from Django's
codebase.


> There was a good tutorial for using threadlocals on the
> official Django wiki but someone deleted it in a fit of spite a few
> years ago.
>

No - there was *a* tutorial several years ago, and it was deleted because
members of the core team got tired of jumping into every conversation where
it was referenced to chime in, yet again, that it was bad practice, with a
whole bunch of potential security implications.

Fixing these problems the right way requires some planning. But for me,
"it's harder to do this properly" isn't a compelling reason to bugger up
your system architecture.

If a third party app doesn't provide a way to pass in the user object, then
*fix the damn third party app*. This is open source, after all, and an
inability to pass in relevant parameters to an operation is a bug (or at
least a missing feature).

And if there's somewhere that Django doesn't do a good job about making it
easy to pass around relevant parameters, *suggest an improvement*. I can
think of a couple of places in the forms library where there is obvious
room for improvement (possible to work around at present, but not as
elegant as a baked-in solution).

Yours,
Russ Magee %-)

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




Re: python

2013-03-14 Thread Russell Keith-Magee
On Thu, Mar 14, 2013 at 11:09 PM, Harjot Mann wrote:

> hello everyone
>
> i have convert the python file to exe file using freeze
> but the executable file is not working..
> when im running it as  ./filename
> it is giving me this error..
>
> Traceback (most recent call last):
>   File "rectangle.py", line 2, in 
> from gasp import *
>   File "/usr/lib/pymodules/python2.7/gasp/__init__.py", line 15, in
> 
> from api import *
>   File "/usr/lib/pymodules/python2.7/gasp/api.py", line 26, in 
> import backend
>   File "/usr/lib/pymodules/python2.7/gasp/backend.py", line 25, in 
> import cairo
>   File "/usr/lib/python2.7/dist-packages/cairo/__init__.py", line 1, in
> 
> from _cairo import *
> ImportError: No module named _cairo
>
> please help me...
>

1) This doesn't appear to be a question about Django. You're going to have
much better luck asking for details about freeze on a Python-specific
mailing list.

2) Which part of error message doesn't make sense? Python can't import the
module _cairo. This means that either you haven't installed Cairo, or it
isn't installed properly. This may well be a side effect of using freeze on
a module that has a binary component -- but as I said in the first point,
you'll need to take that up on a Python mailing list.

Yours,
Russ Magee %-)

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




Re: plugin for selecting files

2013-03-14 Thread Shawn Milochik
On Thu, Mar 14, 2013 at 6:03 PM, Larry Martell  wrote:
>
> I have been googing this for 2 days and trying lots of different
> things, without success. I really appreciate your help - I've made
> more progress in the last hour when in the previous 48.


Glad I could help, but you really should search the Django docs and
Google first. This is definitely one you would have found in the
Django docs.

https://docs.djangoproject.com/en/1.5/topics/http/file-uploads/

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




Re: Django static files STATIC_ROOT vs STATICFILES_FINDERS

2013-03-14 Thread Hartmut
I like this explanation very much, thank You. I didn't know, that 
STATICFILES_DIRS is the source for the DEV-server serving static files. 
That is a big help. Now, as a consequence, in my project I've renamed the 
empty static folder (where the collects go into) to "static_collected", 
that means:
STATIC_ROOT = os.path.join(SITE_ROOT, '*static_collected*')
Than its more clear to me and I don't mix it up again ;-)

On Monday, April 23, 2012 1:38:38 PM UTC+2, Philip wrote:
>
>  There is a slight difference:
>
>- STATIC_ROOT is where you would like the files to be collected to 
>when you run "manage.py collectstatic" and should be empty to begin with. 
>- STATICFILES_DIRS is where the actual files are located and they will 
>be automagically servered under the development server. 
>- You can also create a folder called "static" in any app and put 
>files in there. 
>
> Regards
> Phil 
>  

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




Re: plugin for selecting files

2013-03-14 Thread Larry Martell
On Thu, Mar 14, 2013 at 4:44 PM, Shawn Milochik  wrote:
> You can certainly upload a file, then parse it or whatever. I'm just
> saying you can't just grab a directory listing from the user.
>
> To upload multiple files, you may be able to just add "multiple" to
> your file upload element. A quick Google search found this:
> http://davidwalsh.name/multiple-file-upload
>
> In any case, your questions have nothing to do with Django. Try Google
> first, in any case.

I have been googing this for 2 days and trying lots of different
things, without success. I really appreciate your help - I've made
more progress in the last hour when in the previous 48.

I know it's not strictly a django question (but it's more django
related then a lot of posts I see here ;-) but I am doing this from a
django app.

So my question now is, once the user has selected their file(s) how do
I get the file contents and names back into my python code so I can
process them.

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




Re: What is the difference between instance.title = attrs.get('title', instance.title) vs instance.title = attrs['title'] ?

2013-03-14 Thread lamen
Hi Mr. Terra,

Thanks so much for these links and your help.  Definitely appreciated.  I 
know I'll just end up using the ModelSerializer class but I like to 
understand what is going on underneath to a reasonable level and it bugs me 
when I can't figure something that I know is basic out.



On Thursday, March 14, 2013 5:23:53 PM UTC-4, Andre Terra (airstrike) wrote:
>
> This is a much better explanation on the use of *args and **keywordargs 
> (**kwargs)
>
>
> http://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/
>
> On Thu, Mar 14, 2013 at 6:22 PM, Andre Terra 
> > wrote:
>
>> About the asterisks, please checkout this link:
>>
>> http://stackoverflow.com/questions/4306574/python-method-function-arguments-starting-with-asterisk-and-dual-asterisk
>>
>> the difference between dict['key'] and dict.get('key', 'something') is 
>> that the second doesn't raise a KeyError exception when 'key' isn't in the 
>> dict; instead, it returns 'something'. this allows for shorter code. please 
>> compare:
>>
>> try:
>> max_retries = config['max_retries']
>> except KeyError:
>> max_retries = 10
>>
>> versus
>>
>> max_retries = config.get('max_retries', 10)
>>
>>
>>
>> Cheers,
>> AT
>>
>>
>> On Thu, Mar 14, 2013 at 6:17 PM, lamen > >wrote:
>>
>>> Hello,
>>>
>>> Not sure what the difference is in the usage of attrs 
>>> I could not find the documentation for this although I'm sure it's going 
>>> to be obvious after the fact.
>>>
>>> Also, could someone tell me what the double asterisks mean in the line
>>> return Comment(**attrs)
>>> ?
>>>
>>> Is this some type of variable length parameter list?  How would 
>>>
>>> return Comment(*attrs) 
>>>
>>> and
>>>
>>>  return Comment(attrs) 
>>>  vs
>>>
>>> be different?
>>>
>>> Thank you!
>>>
>>> class CommentSerializer(serializers.Serializer):
>>> email = serializers.EmailField()
>>> content = serializers.CharField(max_length=200)
>>> created = serializers.DateTimeField()
>>>
>>> def restore_object(self, attrs, instance=None):
>>> if instance is not None:
>>> instance.title = attrs['title']
>>> instance.content = attrs['content']
>>> instance.created = attrs['created']
>>> return instance
>>> return Comment(**attrs)
>>>
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com
>>> .
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>
>

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




Re: plugin for selecting files

2013-03-14 Thread Shawn Milochik
You can certainly upload a file, then parse it or whatever. I'm just
saying you can't just grab a directory listing from the user.

To upload multiple files, you may be able to just add "multiple" to
your file upload element. A quick Google search found this:
http://davidwalsh.name/multiple-file-upload

In any case, your questions have nothing to do with Django. Try Google
first, in any case.

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




Re: plugin for selecting files

2013-03-14 Thread Larry Martell
On Thu, Mar 14, 2013 at 4:27 PM, Shawn Milochik  wrote:
> On Thu, Mar 14, 2013 at 4:54 PM, Larry Martell  
> wrote:
>> On Thu, Mar 14, 2013 at 3:43 PM, Shawn Milochik  wrote:
>>> If you have an HTML file input field in your template you get one
>>> automatically from your browser.
>>
>> Thanks! Do you know how to change the text displayed in the button?
>> It's displaying 'Choose File' and I want it to have something else.
>> Also once the user selects the file(s) how do I get the list of names
>> back into my python code?
>
> You can't, and you can't. The text in the button comes from your
> browser and the language in it will change based on your browser's
> language setting. The only way to "change" it is to fake it by using
> CSS to hide it and display something on top of it.
>
> You can't get the list of files from the user's OS into your Web app.
> That would be a glaring security flaw.

I have a requirement to allow the user to select a list of files, and
then I need to get those files and do all kinds of processing on them
(parsing, updating the database, converting them, etc.) There must be
a way to do that.

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




Django on Mediatemple DV (4.0) in Virtualenv

2013-03-14 Thread Tim Walzer
I am currently trying to install Django on a Mediatemple DV (4.0) server 
and have the installation be within a virtualenv.  The django app will be 
run from a subdomain, *parts.domain.com*, while the root domain *domain.com* is 
serving a wordpress site.

I have django installed inside the virtualenv at *
/var/www/vhosts/domain.com/parts/env/* The virtual environment is *'env'.  *The 
server is running python 2.4.3, but I needed at least 2.6, so I installed 
2.6 inside the virtual env and that worked perfectly for setting up the 
initial django site.  Now the problem comes with the running of django.

I created a vhost.conf file under */var/www/vhosts/parts.domain.com/conf*
*
*

   SetHandler python-program
PythonPath "['/var/www/vhosts/domain.com/parts/env/bin', 
'/var/www/vhosts/domain.com/parts/env/store'] + sys.path"
PythonHandler virtualproject
SetEnv DJANGO_SETTINGS_MODULE store.settings


 The path to virtualproject, referenced in the PythonHandler line, is 
*/var/www/vhosts/domain.com/parts/env/bin/virtualproject.py. 
 *

The contents of that file are:

*activate_this = '/var/www/vhosts/domain.com/parts/env/bin/activate_this.py'
*
*execfile(activate_this, dict(__file__=activate_this))*
*
*
*from django.core.handlers.modpython import handler*
*
*
The activate_this.py file is the one that comes with the virtualenv 
installation

When I go to the site *parts.domain.com*, I get the following error in the 
apache logs:

[Thu Mar 14 17:29:45 2013] [error] [client ] PythonHandler virtualproject: 
Traceback (most recent call last):
[Thu Mar 14 17:29:45 2013] [error] [client ] PythonHandler virtualproject: 
  File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line 287, 
in HandlerDispatch\nlog=debug)
[Thu Mar 14 17:29:45 2013] [error] [client ] PythonHandler virtualproject: 
  File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line 464, 
in import_module\nmodule = imp.load_module(mname, f, p, d)
[Thu Mar 14 17:29:45 2013] [error] [client ] PythonHandler virtualproject: 
  File "/var/www/vhosts/domain.com/parts/env/bin/virtualproject.py", line 
4, in ?\nfrom django.core.handlers.modpython import handler
[Thu Mar 14 17:29:45 2013] [error] [client ] PythonHandler virtualproject: 
ImportError: No module named django.core.handlers.modpython

I can only think that this is happening because apache is attempting to use 
the system default python2.4 instead of the one in my virtualenv where 
django is installed.  How do I fix this?

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




Re: plugin for selecting files

2013-03-14 Thread Shawn Milochik
On Thu, Mar 14, 2013 at 4:54 PM, Larry Martell  wrote:
> On Thu, Mar 14, 2013 at 3:43 PM, Shawn Milochik  wrote:
>> If you have an HTML file input field in your template you get one
>> automatically from your browser.
>
> Thanks! Do you know how to change the text displayed in the button?
> It's displaying 'Choose File' and I want it to have something else.
> Also once the user selects the file(s) how do I get the list of names
> back into my python code?

You can't, and you can't. The text in the button comes from your
browser and the language in it will change based on your browser's
language setting. The only way to "change" it is to fake it by using
CSS to hide it and display something on top of it.

You can't get the list of files from the user's OS into your Web app.
That would be a glaring security flaw.

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




Re: What is the difference between instance.title = attrs.get('title', instance.title) vs instance.title = attrs['title'] ?

2013-03-14 Thread Andre Terra
This is a much better explanation on the use of *args and **keywordargs
(**kwargs)

http://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/

On Thu, Mar 14, 2013 at 6:22 PM, Andre Terra  wrote:

> About the asterisks, please checkout this link:
>
> http://stackoverflow.com/questions/4306574/python-method-function-arguments-starting-with-asterisk-and-dual-asterisk
>
> the difference between dict['key'] and dict.get('key', 'something') is
> that the second doesn't raise a KeyError exception when 'key' isn't in the
> dict; instead, it returns 'something'. this allows for shorter code. please
> compare:
>
> try:
> max_retries = config['max_retries']
> except KeyError:
> max_retries = 10
>
> versus
>
> max_retries = config.get('max_retries', 10)
>
>
>
> Cheers,
> AT
>
>
> On Thu, Mar 14, 2013 at 6:17 PM, lamen  wrote:
>
>> Hello,
>>
>> Not sure what the difference is in the usage of attrs
>> I could not find the documentation for this although I'm sure it's going
>> to be obvious after the fact.
>>
>> Also, could someone tell me what the double asterisks mean in the line
>> return Comment(**attrs)
>> ?
>>
>> Is this some type of variable length parameter list?  How would
>>
>> return Comment(*attrs)
>>
>> and
>>
>>  return Comment(attrs)
>>  vs
>>
>> be different?
>>
>> Thank you!
>>
>> class CommentSerializer(serializers.Serializer):
>> email = serializers.EmailField()
>> content = serializers.CharField(max_length=200)
>> created = serializers.DateTimeField()
>>
>> def restore_object(self, attrs, instance=None):
>> if instance is not None:
>> instance.title = attrs['title']
>> instance.content = attrs['content']
>> instance.created = attrs['created']
>> return instance
>> return Comment(**attrs)
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

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




Re: Can anyone give me a suggestion or a recommendation as to how I can access the current user's username in the models.py?

2013-03-14 Thread Shawn Milochik
I've repeatedly asked about this over the past couple of years and
there seems to be no "right" answer." This, to me, is the biggest flaw
in Django.

The official (and useless) answer is that you must pass "user" in
everywhere you save anything. This is stupid, obviously, because you
can not rewrite every third-party app to support this (among other
reasons). There was a good tutorial for using threadlocals on the
official Django wiki but someone deleted it in a fit of spite a few
years ago.

If you search for "audit user shawn milochik" in this Google Group
(https://groups.google.com/forum/?hl=en&fromgroups=#!searchin/django-users/audit$20user$20shawn$20milochik)
you'll get all the conversations I was involved in, which is, as far
as I know, all of them over the past four years.

The suggestion by Waldek Herka in one of those threads above works; I
just tested it. If anyone knows of any reason why it's a bad idea I'd
like to know.

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




Re: What is the difference between instance.title = attrs.get('title', instance.title) vs instance.title = attrs['title'] ?

2013-03-14 Thread Andre Terra
About the asterisks, please checkout this link:
http://stackoverflow.com/questions/4306574/python-method-function-arguments-starting-with-asterisk-and-dual-asterisk

the difference between dict['key'] and dict.get('key', 'something') is that
the second doesn't raise a KeyError exception when 'key' isn't in the dict;
instead, it returns 'something'. this allows for shorter code. please
compare:

try:
max_retries = config['max_retries']
except KeyError:
max_retries = 10

versus

max_retries = config.get('max_retries', 10)



Cheers,
AT


On Thu, Mar 14, 2013 at 6:17 PM, lamen  wrote:

> Hello,
>
> Not sure what the difference is in the usage of attrs
> I could not find the documentation for this although I'm sure it's going
> to be obvious after the fact.
>
> Also, could someone tell me what the double asterisks mean in the line
> return Comment(**attrs)
> ?
>
> Is this some type of variable length parameter list?  How would
>
> return Comment(*attrs)
>
> and
>
>  return Comment(attrs)
>  vs
>
> be different?
>
> Thank you!
>
> class CommentSerializer(serializers.Serializer):
> email = serializers.EmailField()
> content = serializers.CharField(max_length=200)
> created = serializers.DateTimeField()
>
> def restore_object(self, attrs, instance=None):
> if instance is not None:
> instance.title = attrs['title']
> instance.content = attrs['content']
> instance.created = attrs['created']
> return instance
> return Comment(**attrs)
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




What is the difference between instance.title = attrs.get('title', instance.title) vs instance.title = attrs['title'] ?

2013-03-14 Thread lamen
Hello,

Not sure what the difference is in the usage of attrs 
I could not find the documentation for this although I'm sure it's going to 
be obvious after the fact.

Also, could someone tell me what the double asterisks mean in the line
return Comment(**attrs)
?

Is this some type of variable length parameter list?  How would 

return Comment(*attrs) 

and

 return Comment(attrs) 
 vs

be different?

Thank you!

class CommentSerializer(serializers.Serializer):
email = serializers.EmailField()
content = serializers.CharField(max_length=200)
created = serializers.DateTimeField()

def restore_object(self, attrs, instance=None):
if instance is not None:
instance.title = attrs['title']
instance.content = attrs['content']
instance.created = attrs['created']
return instance
return Comment(**attrs)

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




Re: Can anyone give me a suggestion or a recommendation as to how I can access the current user's username in the models.py?

2013-03-14 Thread Hendrik Speidel
Hi,

Accessing the request within models may be problematic ... E.g. when using a 
management command, there is no request.

However, it's doable:

-implement a middleware that takes the request or request.user and stores it in 
a thread local
-register this middleware in your settings
-in your model, you can now access the request/request.user by accessing the 
thread local variable

We have done stuff like that in some of our projects ... Works well
However, i consider it a bit of a hack...

Hope that helps

Best,
Hendrik

Sent from my mobile phone

- Reply message -
From: "Simon Chan" 
To: 
Subject: Can anyone give me a suggestion or a recommendation as to how I can 
access the current user's username in the models.py?
Date: Thu, Mar 14, 2013 19:59


Essentially, I'm just trying to make a simple email alert system. If anyone 
creates, modifies or deletes an entry in the admin back end, I'll receive 
an email as to which user did what to which model. I already figured out 
how to detect the 3 user actions mentioned above in the models.py as well 
as how to send email templates. The issue is that I need to the current 
user information to insert into that email template. And like I mentioned 
before, this is an admin back end, meaning I'm not touching the views.py at 
all. 

If there are any other ways to accomplish this, I'm all ears!

Thanks

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


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




Re: Problems install/download Django 1.5

2013-03-14 Thread Shawn Milochik
On Thu, Mar 14, 2013 at 3:51 PM,   wrote:
> Sorry can't find a message from you in this newsgroup with any virtualinv
> instructions.
>


https://groups.google.com/d/msg/django-users/aRfuUHY21CU/L9UukI7CmxoJ

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




Re: plugin for selecting files

2013-03-14 Thread Larry Martell
On Thu, Mar 14, 2013 at 3:43 PM, Shawn Milochik  wrote:
> If you have an HTML file input field in your template you get one
> automatically from your browser.

Thanks! Do you know how to change the text displayed in the button?
It's displaying 'Choose File' and I want it to have something else.
Also once the user selects the file(s) how do I get the list of names
back into my python code?

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




Re: plugin for selecting files

2013-03-14 Thread Shawn Milochik
If you have an HTML file input field in your template you get one
automatically from your browser.

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




Re: plugin for selecting files

2013-03-14 Thread Larry Martell
On Wed, Mar 13, 2013 at 6:09 PM, Larry Martell  wrote:
> Anyone know of a good plugin or javascript/jQuery package that I can
> use for a dialog box for navigating and selecting files (just like
> when you select "Open File ..." for example)?

I didn't get any replies, so maybe I didn't ask my question well. What
I want to do it call the user's computer's file picker when the user
clicks on a button in my app. Does anyone know how to do this, or can
someone point me at some docs for doing this?

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




FieldError with ManyToMany relationship in ModelAdmin list_display item when server is not in DEBUG mode

2013-03-14 Thread Eric Bass
I can not for the life of me figure out why my list_display works when the 
django server is in DEBUG=True but not when it is in DEBUG=False. I am 
using Django 1.4.3 (mod_wsgi 3.4/Python 2.7) 


 Here is the partial stack trace...


  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/manager.py", 
line 116, in all
return self.get_query_set()

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/fields/related.py",
 
line 565, in get_query_set
return super(ManyRelatedManager, self).get_query_set().using(
db)._next_is_sticky().filter(**self.core_filters)

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/query.py", 
line 624, in filter
return self._filter_or_exclude(False, *args, **kwargs)

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/query.py", 
line 642, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/sql/query.py", 
line 1250, in add_q
can_reuse=used_aliases, force_having=force_having)

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/sql/query.py", 
line 1122, in add_filter
process_extras=process_extras)

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/sql/query.py", 
line 1316, in setup_joins
"Choices are: %s" % (name, ", ".join(names)))

*FieldError: Cannot resolve keyword 'rsvp_guests' into field. Choices are: 
city, event, first_name, id, last_name, state, street, zip_code*

My models looks as follows...

class Guest(models.Model):
first_name = models.CharField(max_length=50,
  help_text="The Guest's given name.")
last_name = models.CharField(max_length=50,
 help_text="The Guest's surname.")
 ...
def __unicode__(self):
return u'{} {}'.format(self.first_name, self.last_name)

class RSVP(models.Model):
event = models.ForeignKey(Event, verbose_name='RSVP Event')
guests = models.ManyToManyField(Guest, verbose_name='Guests',
related_name='rsvp_guests',
limit_choices_to = { 'id__in': 
Event.objects.all().values('guests').query })
...

and the admin.py entry looks like so:

def guest_names(obj):
   return u', '.join([unicode(guest) for guest in obj.guests.all()])

class RSVPAdmin(admin.ModelAdmin):
list_display = ['event', guest_names, 'max_invites', 'response',
'response_datetime', 'updated_by']
filter_horizontal = ('guests', )


thanks, in advance, for your help!!!

/Eric

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




Re: Problems install/download Django 1.5

2013-03-14 Thread Lachlan Musicman
On 15 March 2013 06:51,   wrote:
> Sorry can't find a message from you in this newsgroup with any virtualinv
> instructions.
>
> Or do you mean this link?:
> https://pypi.python.org/pypi/virtualenv
>
> This text _is_ detailed with regard to virtualenv, but the combination with
> apache/wsgi on debian would pose more questions.
>
> Apart from my question, it would really make sense to have Django install
> instructions for a debian/ubuntu server in the django docs.
> This would lower the entrance hurdles to check out Django for many website
> admins.

I disagree - the docs are very well written and work across platform.
There's no need for .deb specialisation.

Virtualenv is dead simple to use and incredibly helpful. The easiest
way to install/use it is:

$ pip install virtualenvwrapper
$ mkvirtualenv project
$ workon project

All pip installs from within that virtualenv will then be localised.

$ pip install Django
$ pip install South
$ pip install MySQL-python #(if you are using mysql)

It will all be contained within your virtualenv.

To conf with Apache, it's just a matter of pointing the server to the
wsgi file within your new project.

Unless there was a specific error message that was the problem, I
don't understand how the brand of linux you are using could affect the
deployment.

cheers
L.


--
The new creativity is pointing, not making. Likewise, in the future,
the best writers will be the best information managers.

http://www.theawl.com/2013/02/an-interview-with-avant-garde-poet-kenneth-goldsmith

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




Re: Can anyone give me a suggestion or a recommendation as to how I can access the current user's username in the models.py?

2013-03-14 Thread Jonathan D. Baker
Perhaps a combination of signals and receivers would fit the bill? Models.py 
shouldn't be concerned with request objects.

Sent from my iPhone

On Mar 14, 2013, at 12:59 PM, Simon Chan  wrote:

> Essentially, I'm just trying to make a simple email alert system. If anyone 
> creates, modifies or deletes an entry in the admin back end, I'll receive an 
> email as to which user did what to which model. I already figured out how to 
> detect the 3 user actions mentioned above in the models.py as well as how to 
> send email templates. The issue is that I need to the current user 
> information to insert into that email template. And like I mentioned before, 
> this is an admin back end, meaning I'm not touching the views.py at all. 
> 
> If there are any other ways to accomplish this, I'm all ears!
> 
> Thanks
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

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




Can anyone give me a suggestion or a recommendation as to how I can access the current user's username in the models.py?

2013-03-14 Thread Simon Chan
Essentially, I'm just trying to make a simple email alert system. If anyone 
creates, modifies or deletes an entry in the admin back end, I'll receive 
an email as to which user did what to which model. I already figured out 
how to detect the 3 user actions mentioned above in the models.py as well 
as how to send email templates. The issue is that I need to the current 
user information to insert into that email template. And like I mentioned 
before, this is an admin back end, meaning I'm not touching the views.py at 
all. 

If there are any other ways to accomplish this, I'm all ears!

Thanks

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




Re: Problems install/download Django 1.5

2013-03-14 Thread breg
Sorry can't find a message from you in this newsgroup with any virtualinv 
instructions.

Or do you mean this link?:
https://pypi.python.org/pypi/virtualenv

This text _is_ detailed with regard to virtualenv, but the combination with 
apache/wsgi on debian would pose more questions. 

Apart from my question, it would really make sense to have Django install 
instructions for a debian/ubuntu server in the django docs.
This would lower the entrance hurdles to check out Django for many website 
admins. 


On Thursday, March 14, 2013 3:06:28 PM UTC+1, Shawn Milochik wrote:
>
> Check out the post I made on this forum about five minutes ago. I put 
> in pretty detailed virtualenv instructions. That should be all you 
> need to get going. 
>

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




Using django-devserver with Werzbeug to debug an app - interactive debugger not being trigged?

2013-03-14 Thread Victor Hooi
Hi,

I'm trying to use django-devserver 
(https://github.com/dcramer/django-devserver) to debug localshop 
(https://github.com/mvantellingen/localshop), a Django-based Pypi server.

I've installed django-devserver and werzbeug.

I then added 'devserver' to INSTALLED_APPS, and have started it up:

(temp)Victors-MacBook-Air:code victorhooi$ localshop runserver --werkzeug
> Validating models...
> 0 errors found
> Django version 1.4.3, using settings 'localshop.settings'
> Running django-devserver 0.4.0
> Threaded werkzeug server is running at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
>  * Running on http://127.0.0.1:8000/


I then try to access the view that triggers a 500 Internal Server Error (in 
this case from a file being in the wrong location).

On the console, I can see:

127.0.0.1 - - [14/Mar/2013 20:31:00] "GET /simple/yolk/ HTTP/1.1" 401 -
> 127.0.0.1 - - [14/Mar/2013 20:31:03] "GET /simple/yolk/ HTTP/1.1" 401 -
> 127.0.0.1 - - [14/Mar/2013 20:31:04] "GET /simple/yolk/ HTTP/1.1" 200 -
> Internal Server Error: /packages/yolk/download/1/yolk-0.4.3.tar.gz
> Traceback (most recent call last):
>   File 
> "/Users/victorhooi/.venvs/temp/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/handlers/base.py",
>  
> line 111, in get_response
> response = callback(request, *callback_args, **callback_kwargs)
>   File 
> "/Users/victorhooi/.venvs/temp/lib/python2.7/site-packages/localshop-0.4.1-py2.7.egg/localshop/apps/packages/views.py",
>  
> line 171, in download_file
> logger.info(release_file.distribution.file)
>   File 
> "/Users/victorhooi/.venvs/temp/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/db/models/fields/files.py",
>  
> line 46, in _get_file
> self._file = self.storage.open(self.name, 'rb')
>   File 
> "/Users/victorhooi/.venvs/temp/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/files/storage.py",
>  
> line 33, in open
> return self._open(name, mode)
>   File 
> "/Users/victorhooi/.venvs/temp/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/files/storage.py",
>  
> line 156, in _open
> return File(open(self.path(name), mode))
> IOError: [Errno 2] No such file or directory: 
> u'/Users/victorhooi/code/source/y/yolk/yolk-0.4.3.tar.gz'
> 127.0.0.1 - - [14/Mar/2013 20:31:04] "GET 
> /packages/yolk/download/1/yolk-0.4.3.tar.gz HTTP/1.1" 500 -


However, I don't seem to get any interactive prompt, or a debugger, or 
anything?

The server just keeps going, ready to receive the next request. Is 
something stopping the debugger from triggering here?

Cheers,
Victor 

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




python

2013-03-14 Thread Harjot Mann
hello everyone

i have convert the python file to exe file using freeze
but the executable file is not working..
when im running it as  ./filename
it is giving me this error..
   
Traceback (most recent call last):
  File "rectangle.py", line 2, in 
from gasp import *
  File "/usr/lib/pymodules/python2.7/gasp/__init__.py", line 15, in 
from api import *
  File "/usr/lib/pymodules/python2.7/gasp/api.py", line 26, in 
import backend
  File "/usr/lib/pymodules/python2.7/gasp/backend.py", line 25, in 
import cairo
  File "/usr/lib/python2.7/dist-packages/cairo/__init__.py", line 1, in 

from _cairo import *
ImportError: No module named _cairo
 
please help me...

thnks in advance...
harjot


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




Re: django / django cms + responsive

2013-03-14 Thread Anurag Chourasia
Look at

1. Twitter Bootstrap. http://twitter.github.com/bootstrap/

2. Foundation Zurb. http://foundation.zurb.com/

Regards,
Anurag
On Mar 14, 2013 7:03 AM, "Frank Bieniek" 
wrote:

> Hi Guys,
> what are your preferred apps to turn django or django cms into a
> responsive website?
>
> What are your recipes?
>
> Thanks
> Frank
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> django-users+unsubscribe@**googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at 
> http://groups.google.com/**group/django-users?hl=en
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>
>
>

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




Re: [ANN] Introducing Brillixy - Django admin skin & customization kit

2013-03-14 Thread Derek
On Tuesday, 12 March 2013 17:58:22 UTC+2, rudyryk wrote:
>
> Hello everyone! 
>
> Today we've released alpha of Brillixy https://github.com/05bit/brillixy. 
>
> This is a Django admin skin with some extras. Actually it's an 
> alternative to Grapelli, Admin Tools and other apps that changes 
> standard Django admin look and user experience. It's simple and 
> minimal at the moment and we're going to keep it the way like that. 
>
> I'm working on it with Vasily Sadovnikov and Pavel Yakovlev - they 
> helped me with vision and are working on design improvevents. Thank 
> you guys! 
>
> Core features: 
>
> - skin powered by basic Twitter Bootstrap with responsive layout + 
> Awesome Font 
> - easy header customization: logo & title 
> - lighter nav breadcrumbs: no application index 
> - custom dashboard panels 
>
> It seems that most of standard admin functions are working. There're 
> some issues with Django 1.4.x inlines, as I used Django 1.5 templates 
> and scrips as basis. And I see we're not perfect with design and 
> navigation, so we're working on that :) 
>
> You're welcome to make a test-drive, and I would really appreciate any 
> feedback. Please, let me know if it does fit your real projects! :) 
>
> Alex K. rudyryk 
> /// 
>

Alex

Looks good ... I think a demo with more items in it would be useful se we 
can see how page navigation works.  It also seems that there is no record 
count when you add a filter (eg. "displaying 5 of 20")?

Two questions:
* will there be guidlines for  customising fonts, colors etc. (the buttons 
are too big & bright right compared to the text)
* how easy is it to change template layout - e.g. I prefer filters on the 
right where they are out the way (preferable hidden by javascript, 
actually); also the elements seem to be scattered on the page and maybe 
they need to be "grouped" somehow (not a designer, just saying what I 
see...)

Derek



 

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




Re: Profiling django apps using Python 3? No hotspot module.

2013-03-14 Thread Thomas Weholt
Thanks a bunch :-) Got it working in python 3 with minor tweaking.

Thomas

On Thu, Mar 14, 2013 at 3:09 PM, Shawn Milochik  wrote:
> I use this and it's great. I haven't tried it with Python 3, but it's
> all standard library stuff.
>
> I tweaked mine a bit so it dumps the profile files to my temp folder
> instead of the way it works by default. That's because I wanted to
> profile AJAX calls, keep multiple runs for the same sites for A/B
> comparisons, and because I don't have to know in advance I'm going to
> want to profile something. I can always just look at the file for
> anything I just did.
>
> https://gist.github.com/1229681
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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




Re: Profiling django apps using Python 3? No hotspot module.

2013-03-14 Thread Shawn Milochik
I use this and it's great. I haven't tried it with Python 3, but it's
all standard library stuff.

I tweaked mine a bit so it dumps the profile files to my temp folder
instead of the way it works by default. That's because I wanted to
profile AJAX calls, keep multiple runs for the same sites for A/B
comparisons, and because I don't have to know in advance I'm going to
want to profile something. I can always just look at the file for
anything I just did.

https://gist.github.com/1229681

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




Re: Problems install/download Django 1.5

2013-03-14 Thread Shawn Milochik
Check out the post I made on this forum about five minutes ago. I put
in pretty detailed virtualenv instructions. That should be all you
need to get going.

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




Re: Novice 101 here

2013-03-14 Thread Jonathan Baker
After you've successfully followed Shawn's directions, you can make your
virtualenv experience even better by installing virtualenvrwapper:
http://virtualenvwrapper.readthedocs.org/en/latest/

On Thu, Mar 14, 2013 at 7:59 AM, Shawn Milochik  wrote:

> Download virtualenv and create a virtualenv by manually typing the
> path to your Python 2.7 executable.
>
> Something like this (path will probably be different on your Mac, type
> "which python2.7" to find it:
>
> /usr/bin/python2.7 virtualenv.py /home/user/my_virtualenv
>
> Then activate your virtualenv:
>
> source /home/user/my_virtualenv/bin/activate
>
> Then you'll have your own Python environment just for this project.
> You can install Django by just running "pip install django," plus any
> other dependencies, without conflicts or requiring root access.
>
> https://pypi.python.org/pypi/virtualenv
>
> You'll just have to activate that virtualenv each time before you
> start working on your project or running your app.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Jonathan D. Baker
Developer
http://jonathandbaker.com

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




Re: Novice 101 here

2013-03-14 Thread Shawn Milochik
Download virtualenv and create a virtualenv by manually typing the
path to your Python 2.7 executable.

Something like this (path will probably be different on your Mac, type
"which python2.7" to find it:

/usr/bin/python2.7 virtualenv.py /home/user/my_virtualenv

Then activate your virtualenv:

source /home/user/my_virtualenv/bin/activate

Then you'll have your own Python environment just for this project.
You can install Django by just running "pip install django," plus any
other dependencies, without conflicts or requiring root access.

https://pypi.python.org/pypi/virtualenv

You'll just have to activate that virtualenv each time before you
start working on your project or running your app.

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




Re: django templates and tex/latex

2013-03-14 Thread Bill Freeman
Note that you don't have to use the Django template engine to render things.

For one thing, if you found a less problematic templating engine, using it
as
well doesn't prevent you from using Django's template engine for other
pages.

You could also roll your own by coming up with, for example, a TeX friendly
syntax for variable substitution (by which I mean, doesn't collide with
syntax
that you will be using - best would be coming up with something that is
actually illegal in TeX), and process things with a big regex or had coded
parser..  You could parse this directly into the output, or this could be a
loading stage that converts the file to a Django template (or engine of your
choice) file, where the TeX/LaTeX stuff that looks like template specials is
converted to a quoted structure that renders as the original.

A final approach would be to use TeX definitions to perform your variable
substitutions, prepending a stanza that makes the definitions at render
time.  (Though making this work where you want template loops is much
harder.)

On Wed, Mar 13, 2013 at 2:15 PM, Ken  wrote:

> Actually, that's exactly what I'm trying to do.  I have database tables
> whose
> columns contain TeX fragments.  I am trying to generate various file
> outputs
> from database searches - TeX, pdf, etc.
>
> I could construct the tex file on the fly with python strings as you
> suggest but
> that's rather cumbersome.  It's simpler with a template.
>
> I've also considered using the xml.element api to construct my own template
> but that would set me back several weeks.  I'm trying to finish. :/
>
> I have something that almost resembles a template.  It is not the most
> flexible
> or elegant but it works.  I have a single replacement string between
> \begin{document} and \end{document} and I simply replace this one token
> with a
> string.replace()
>
>
>
>
> On Wednesday, March 13, 2013 11:39:18 AM UTC-5, Drew Ferguson wrote:
>
>> On Wed, 13 Mar 2013 07:01:45 -0700 (PDT)
>> Ken  wrote:
>>
>> > I would like to write a tex/latex file with django tags in it.  Load it
>> > with the template loader and render it with a context.  The problem is
>> > that my tex/latex file has quite a few '{%' in them.   They are
>> > conventional in TeX for writing readable macros and are used to escape
>> > the newline.  I could try rewriting them but before I do, I thought I'd
>> > ask if this is even worth tackling.  TeX uses curly braces as grouping
>> > and percent signs as a comment.
>> >
>> > The TeX file would look rather confusing but the more important
>> question
>> > is what the loader does when it sees braces and brace comments.  Is it
>> > possible to reassign the block and variable tags?
>> >
>> > Thanks
>> >
>> >
>>
>> I have done this in the past (with Plone rather than django) by calling a
>> python wrapper script to generate a file which latex can process;
>> essentially construct the Latex source as python strings
>> and have the script assemble the components you want. The objective was
>> to
>> generate a PDF file by Latex with variables fed from SQL & a web page.
>> But
>> this may not be what you are interested in.
>>
>> Are you trying to render a Latex source document as a web page?
>>
>> --
>> Drew
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




How best to cache a queryset of Comments?

2013-03-14 Thread Phil Gyford
I have a site that uses the standard Django Comments app (well, a subclass
of it, with not many changes) for comments on different content types.

I'd like to be able to cache a list of comments, as fetching the comments
is one of the most frequent and slowest queries that's happening at the
moment.

But I can't see the simplest way to perform this caching. (I'm already
using the per-site cache for logged-out users and per-view cache on a few
views, using memcache.)

At the moment the queryset comes from RenderCommentListNode's render()
method <
https://github.com/django/django/blob/stable/1.5.x/django/contrib/comments/templatetags/comments.py#L200>
So I could subclass RenderCommentListNode, copy the render() method, and
add caching there... but it feels a bit clunky and hacky compared to most
customising I end up doing with Django these days... so is this the
best/only way?

Phil

-- 
http://www.gyford.com/

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




Re: Novice 101 here

2013-03-14 Thread songdeed
I'll revise that to having django 1.5... not that it makes much difference 
to my issue I am sure.

On Thursday, March 14, 2013 11:03:40 PM UTC+13, song...@gmail.com wrote:
>
> Mac Os X version 10.4.11 (pretty old desktop but believe it's sufficient 
> to do the job)
> Python version 2.7.3
> also appear to have a version 2.3 of python on here , not sure if that's 
> any issue.
>
>
> I have a problem linking python to django
>
> So to keep things simple I have no idea . 
> https://www.djangoproject.com/download/ 
>   ---> 
>  "You can also download a zipped 
> archive of 
> the development version." This looked like the easiest way so I downloaded 
> it here which I believe is 1.4 v 
> When I go to site packages following python path - all there was in the 
> folder was "read me"
>  
> I tried importing and installing it in terminal but it came up with "no 
> module named django"
>
> So my question is, which probably makes me look real clueless, is how do I 
> get the right django file to cross into this path? Also, is the 'read me' 
> file the only thing that should be in there, regardless of the the first 
> question?
>
>
> Cheers.
>

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




Novice 101 here

2013-03-14 Thread songdeed
Mac Os X version 10.4.11 (pretty old desktop but believe it's sufficient to 
do the job)
Python version 2.7.3
also appear to have a version 2.3 of python on here , not sure if that's 
any issue.


I have a problem linking python to django

So to keep things simple I have no idea . 
https://www.djangoproject.com/download/ 
  ---> 
 "You can also download a zipped 
archive of 
the development version." This looked like the easiest way so I downloaded 
it here which I believe is 1.4 v 
When I go to site packages following python path - all there was in the 
folder was "read me"
 
I tried importing and installing it in terminal but it came up with "no 
module named django"

So my question is, which probably makes me look real clueless, is how do I 
get the right django file to cross into this path? Also, is the 'read me' 
file the only thing that should be in there, regardless of the the first 
question?


Cheers.

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




django mysql charset settings

2013-03-14 Thread peixinchen
my MySQL variables like this:
| character_set_client | latin1
| character_set_connection | latin1   
| character_set_database   | utf8   

How can i set in django could make character_set_client and 
character_set_connection to 'UTF-8'?

I could using MySQLdb like this MySQLdb.connect(..., charset="utf-8").


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




django / django cms + responsive

2013-03-14 Thread Frank Bieniek

Hi Guys,
what are your preferred apps to turn django or django cms into a 
responsive website?


What are your recipes?

Thanks
Frank

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




Re: Problems install/download Django 1.5

2013-03-14 Thread breg
"Internal server error" - standard apache message.
But to clarify: when I take the syntax typos out, the poll admin backend 
works fine. 
So somehow just the "Debug = true" does not trigger the django error 
handler any more. 
This might be caused by my (failed) trials to "Install current Django on 
current Debian with current Python", see other thread.
So I dont want to bother you or the public with these issues. 
The virtual environment thread I will follow as soon as I find the time. 


On Wednesday, March 13, 2013 6:15:22 PM UTC+1, Shawn Milochik wrote:
>
> On Wed, Mar 13, 2013 at 12:55 PM,  > wrote: 
> > Okay - now I directly get server errors, so the Django error handler is 
> > passed by... 
> > 
>
> It helps if you post the errors. 
>

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




Profiling django apps using Python 3? No hotspot module.

2013-03-14 Thread Thomas Weholt
I've tried to find middleware for django or other methods of profiling
my django apps, but most of them seem to use the hotspot module and
since I use Python 3 and there's no hotspot module in Python 3 I was
wondering if anybody out there had a working profiler for django
compatible with Python 3?

If not I'll try to port one of the ones I've found but why re-invent the wheel?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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




Re: Asking for opinion about an Agile Web Framework Comparison

2013-03-14 Thread SeS
hi David, 

Very nice work, i appreciate how well it's structured and planned,
but term 'agile web frameworks' wonders me every time i saw it is used.
Isn't it true that 'agile' is a certain methodology, set of practices which 
might be applied to a many processes humans involved in,
including software development? Why agile should have any dependencies to 
any particular framework at all? 
What if we throw out all frameworks like they never been invented, should 
we then still use agile methodology? 
I believe yes. Particular tools or even application area to some extend 
transparent for methodology, so using word 'agile' in combination with 
'framework' just add some entropy and disorient,
let's social psychologists or marketing guys use it if they believe it can 
bring any additional attention to promoted tool, why we should support such 
term misusing.
Just my 2 cents.

regards,
Sergei
> 

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




Re: direct_to_template replacement for django 1.5?

2013-03-14 Thread Russell Keith-Magee
On Thu, Mar 14, 2013 at 3:20 PM, alex.v.ko...@gmail.com <
alex.v.ko...@gmail.com> wrote:

> Hi,
>
> In django 1.4 and prior the following shortcut has been found and used
> extensively:
>
> ---
> from django.views.generic.simple import direct_to_template
> def home(request):
> return direct_to_template(request, 'form.html', {'somevar':1})
> ---
>
> This is much shorter then to write full:
> ---
> from django.shortcuts import render_to_response, get_object_or_404
> from django.template import RequestContext
> return render_to_response('form.html', RequestContext(request,
> {'somevar':1}))
> ---
>
> Are there good shortcut for the same in Django 1.5?
>

Yes, there is -- Django 1.4 introduced the "render" shortcut:

from django.shortcuts import render

def my_view(request):

return render(request, 'form.html', {'samovar': 1})

Yours,
Russ Magee %-)

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




direct_to_template replacement for django 1.5?

2013-03-14 Thread alex.v.ko...@gmail.com
Hi,

In django 1.4 and prior the following shortcut has been found and used 
extensively:

---
from django.views.generic.simple import direct_to_template
def home(request):
return direct_to_template(request, 'form.html', {'somevar':1})
---

This is much shorter then to write full:
---
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
return render_to_response('form.html', RequestContext(request, 
{'somevar':1}))
---

Are there good shortcut for the same in Django 1.5? Or may be I should
use my own function for this?

Thanks.

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