Re: same code runs on two machines and barfs on the third

2012-02-06 Thread kenneth gonsalves
On Tue, 2012-02-07 at 08:06 +0100, Babatunde Akinyanmi wrote:
> Perhaps you made a change to a model and forgot to syncdb on your
> Fedora 15 machine. 

no
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: same code runs on two machines and barfs on the third

2012-02-06 Thread Babatunde Akinyanmi
Perhaps you made a change to a model and forgot to syncdb on your
Fedora 15 machine.

On 2/7/12, kenneth gonsalves  wrote:
> hi,
>
> this is the relevant part of my model:
>
> class Team(models.Model):
> name = models.CharField(_("Team Name"),max_length=150,unique=True)
> members =
> tournament = models.ForeignKey(Tournament)
>
> in my view I have the following line of code:
> cr = Team.objects.filter(tournament_id=tournid)
>
> I have three installations of this app. All have the latest trunk (all
> the same version). The only difference between the three is that one is
> on Fedora 14, one on Fedora 15 and one on Fedora 16. Deployment is the
> same. All are on python 2.7 with slightly differing versions of
> postgresql. On Fedora 14 and 16 the code runs ok. On Fedora 15, django
> barfs saying:
> 'cannot resolve tournament_id into a field, fields available are: name,
> tournament ...'
>
> any clues?
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

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



same code runs on two machines and barfs on the third

2012-02-06 Thread kenneth gonsalves
hi,

this is the relevant part of my model:

class Team(models.Model):
name = models.CharField(_("Team Name"),max_length=150,unique=True)
members = 
tournament = models.ForeignKey(Tournament)

in my view I have the following line of code:
cr = Team.objects.filter(tournament_id=tournid)

I have three installations of this app. All have the latest trunk (all
the same version). The only difference between the three is that one is
on Fedora 14, one on Fedora 15 and one on Fedora 16. Deployment is the
same. All are on python 2.7 with slightly differing versions of
postgresql. On Fedora 14 and 16 the code runs ok. On Fedora 15, django
barfs saying:
'cannot resolve tournament_id into a field, fields available are: name,
tournament ...'

any clues?
-- 
regards
Kenneth Gonsalves

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



Re: Problems with Django Form Processing

2012-02-06 Thread Jason
Your numerical values might be considered strings for that comparison.
Try:

if int(p) > 2:
...

On Jan 16, 11:05 pm, zhyr28  wrote:
> Hi all, I want to develop a survey app that has ten radio selects.
> After people submit the survey, the data will be processing and then
> output the result. I met a problem when I was trying to process the
> data from the form. Here is the code:
>
> forms.py: contains the survey questions.
> QUESTION_ONE= (('4','Black',), ('3', 'Red',), ('2', 'Green',), ('1',
> 'Purple',))
> lass SurveyForm(forms.Form):
>     q1 = forms.ChoiceField(
>         widget=forms.RadioSelect,                         # radio select
>         label=u" 1. What's your prefered colour?",
>         choices = QUESTION_ONE                     # four choices
>     )
>
> views.py
>   def take_survey(request):
>         if request.method=='POST':
>                 form = SurveyForm(request.POST)
>                 if form.is_valid():
>                         p1 = form.cleaned_data['q1']    # get the result of 
> input
>                p = p1[0]                                        #get
> the number
>                if p>2:
>                   return HttpResponseRedirect('a.html')       # if
> user choose black or red, then redirect user to a.html
>
>  i cannot get the correct result, but I do not know which step is
> wrong. Hope someone could help me. Thank you.

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



django on windows azure

2012-02-06 Thread Eugeny Klementev
Hello,

I'm porting django application on windows azure cloud.
I looking for ways to use azure's database from django application.

I see two ways:
1. Use Azure SQL and use the any open-source odbc backend (i found
django-pyodbc http://code.google.com/p/django-pyodbc/)

2. Use the windows azure table starage and use custom db backend.

Anybody use azure databases? And which way is more preferable?

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

2012-02-06 Thread Kelly Nicholes
This is link holds the PERFECT answer for you:
http://bit.ly/wc0psc

If you want to do it differently, try:

First you'll have to send an XMLHttpRequest (jQuery post() or get())
to your server to post a form (create a modelform with a "Comment"
model with all of the required fields.  You might want to look into
generic content types for django models).  Save the comment out
(associate it with the user from the request) in your view.  Then add
a link to do a comment (if you want you can do fancy html5 stuff with
the "editable" property on some div).  The click the link, dynamically
(use jquery) to show another form (or create it if you'd like).  When
they submit the friend comment, associate that friend comment with the
original comment (you could parse this out of the ID attribute that
you could set on the original comment) and save it just as you did the
first...  Or just look for premade things...

You could look into django's built-in comment system
https://docs.djangoproject.com/en/1.2/ref/contrib/comments/example/
Here's one called django-facebook-comments 
https://bitbucket.org/sirpengi/django-facebook-comments

On Jan 23, 4:38 am, coded kid  wrote:
>  Please how can I get user post update, make their friends comment and
> share the update in django? Just like the way FB update is. I hope you
> get my point?  Thanks so much

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

2012-02-06 Thread Russell Keith-Magee

http://www.isup.me/djangoproject.com

I don't know what's happening at *your* end, but djangoproject.com is working 
for me right now, and I'm not aware of any major outages over the last couple 
of days. We hosted a sprint this past weekend, so if there was an outage, I 
think we would have noticed.

Yours,
Russ Magee %-)


On 07/02/2012, at 7:41 AM, DSblizzard wrote:

> What's happening with it? It's unavailable for several days.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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.



Multiple Django Virtual Hosts on Apache+mod_wsgi but only one gets served

2012-02-06 Thread Chris Cuilla
I've been struggling to figure out the following problem and am hoping
someone else has seen this.

I have a server running Apache 2 w/mod_wsgi. I've setup multiple,
different Django apps. Each has its own virtual host configuration
(see below).

This is on a local test server and my client machines have /etc/hosts
configured to point both app_a and app_b hostnames to the same
machine.

The problem I have is that Apache is only serving app_a regardless of
whether I go to app_a or app_b in my browser.

Has anyone seen anything like this?

P.S. When configured as plain, vanilla virtual hosts (i.e., no
mod_wsgi) the virtual hosting works just fine.



ServerName app_a


Order deny,allow
Allow from all



Order deny,allow
Allow from all



Order deny,allow
Allow from all


LogLevel warn
ErrorLog  /home/app_a/public_html/app_a/logs/apache_error.log
CustomLog /home/app_a/public_html/app_a/logs/apache_access.log
combined

WSGIDaemonProcess app_a user=www-data group=www-data threads=20
processes=2 display-name=app_a
WSGIProcessGroup app_a

WSGIScriptAlias / /home/app_a/public_html/app_a/app_a/app.wsgi



ServerName app_b


Order deny,allow
Allow from all



Order deny,allow
Allow from all



Order deny,allow
Allow from all


LogLevel warn
ErrorLog  /home/app_b/public_html/app_b/logs/apache_error.log
CustomLog /home/app_b/public_html/app_b/logs/apache_access.log
combined

WSGIDaemonProcess app_b user=www-data group=www-data threads=20
processes=2 display-name=app_b
WSGIProcessGroup app_b

WSGIScriptAlias / /home/app_b/public_html/app_b/app_b/app.wsgi


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



djangoproject.com

2012-02-06 Thread DSblizzard
What's happening with it? It's unavailable for several days.

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

2012-02-06 Thread larry.mart...@gmail.com


On Feb 5, 4:13 pm, "larry.mart...@gmail.com" 
wrote:
> On Feb 5, 4:05 pm, Dennis Lee Bieber  wrote:
>
>
>
>
>
>
>
> > On Sun, 5 Feb 2012 14:08:52 -0800 (PST), "larry.mart...@gmail.com"
>
> >  wrote:
>
> > >It's exactly the same sys.path I get from command line python, where
> > >the import works.
>
> >         NO IT ISN'T!
>
> > >['/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg', '/
> >         
> > >['', '/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg',
>
> >         Note the difference? The latter includes "current working directory"
> > as the first entry.
>
> Ok, I didn't notice that. However wouldn't the cwd be '.' and not an
> empty sting? In any case, when I try the import from command line
> python, I am not in the dir containing django.core.handlers.wsgi.
>
> -larry

> On Feb 5, 4:32 pm, Graham Dumpleton 
> wrote:

> > At the start of the WSGI script file, add:

> >   import django
> >   print django.__file__

> > In other words, work out whether top level 'django' can be installed
> > and if so where it is coming from.

> > You might inadvertently have a django.py file sitting somewhere which
> > it is finding by mistake.

> When I add that I get:

> [Mon Feb 06 06:36:57 2012] [error] [client 127.0.0.1] import
> django
> [Mon Feb 06 06:36:57 2012] [error] [client 127.0.0.1] ImportError: No
> module named django

> When I do the same from command like python I get:

> $ python
> Python 2.6.6 (r266:84292, Dec  7 2011, 20:38:36)
> [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>> 
> import django
> >>> print django.__file__

> /usr/lib/python2.6/site-packages/django/__init__.py

> When I print sys.path from my wsgi script /usr/lib/python2.6/site-
> packages is there. Does /usr/lib/python2.6/site-packages/django need
> to be given somewhere?


I re-installed django and that seems to have fixed the problem. Not
sure why it did - I installed it the same way as I did before, but
whatever, it works now.

-larry

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



Re: Checking template

2012-02-06 Thread Andy McKay
On Mon, Feb 6, 2012 at 9:04 AM, xina towner  wrote:
> How can I  check the template of a view??
..
>         self.assertTemplateUsed(resp, 'name_of_the_template', 'Bad
> Template')

Yes, the docs on assertTemplateUsed are at:

https://docs.djangoproject.com/en/dev/topics/testing/#django.test.TestCase.assertTemplateUsed

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

2012-02-06 Thread Thorsten Sanders
You are using the tutorial of the development version which is 1.4 
alpha, but using yourself version 1.3.1, so you need to use


django.conf.urls.defaults instead of django.conf.urls

Better use the 1.3 tutorial instead of the development one to not run into such 
troubles.


Am 06.02.2012 23:23, schrieb John Paton:

Thanks for the help.

Here's what it says: from django.conf.urls import patterns, include,
url

and then it says unresolved import: url, include, patterns.

Can you tell me what is going wrong here.

Thanks!



On Feb 6, 12:02 pm, Pavlo Kapyshin  wrote:

As this exception says, you have an error on first line of urls.py.
Double-check that line.


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

2012-02-06 Thread John Paton
Thanks for the help.

Here's what it says: from django.conf.urls import patterns, include,
url

and then it says unresolved import: url, include, patterns.

Can you tell me what is going wrong here.

Thanks!



On Feb 6, 12:02 pm, Pavlo Kapyshin  wrote:
> As this exception says, you have an error on first line of urls.py.
> Double-check that line.

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



Re: How to check the HTTP_HOST from templates/404.html when using flat pages

2012-02-06 Thread tiff
I must have been tired!
Simply added code to existing context processor to 
provide request.META['HTTP_HOST'] as a variable in the returned dictionary.
Doh!

-- 
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/-/SOkxTYIvBWYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: No Module named URLS

2012-02-06 Thread Sandro Dutra
If I understand you're writing a template for admin, and this is not
required 'cause the admin template is called by the contrib
'django.contrib.admin', in INSTALLED_APPS (settings file), only if you
want to customize admin, you can override the admin files, putting
them o 'yourtemplatesdir/admin/', and I think this is not the case.

The only required steps to see the admin page is:
1. Check if 'django.contrib.admin' is uncommented in 'settings.py';
2. Uncomment the required lines in file 'urls.py';
3. Launch the dev server and acess localhost/admin/.

Only this, nothing more...

Templates.py? Templates can have any extension, this is true, but
usually we put .html or .htm...

2012/2/6 akaariai :
> On Feb 6, 5:09 pm, coded kid  wrote:
>> Hey guys, I’m getting an error when trying to visit my admin page:
>> TemplateSyntaxError at /admin/
>> Caught ImportError while rendering: No module named urls
>>
>> In urls.py
>> from django.conf.urls.defaults import patterns, include, url
>> from django.contrib import admin
>> admin.autodiscover()
>>
>> urlpatterns = patterns('',
>> (r'^admin/',include(admin.site.urls)),
>> )
>>
>> In Template.py
>>
>>    
>> {% block branding %}{% endblock %}
>>   {% if user.is_active and user.is_staff %}
>>    {% trans 'Welcome,' %}  {% filter
>> force_escape %}{% firstof user.first_name user.username %}{% endfilter
>> %}.
>>  {% block userlinks %} {% url 'django-admindocs-docroot' as docsroot
>> %}  {% if docsroot %}  {% trans
>> 'Documentation' %} {% endif %}  {% url 'admin:password_change' as
>> password_change_url %}  {% if password_change_url %} 37 > href="{{ password_change_url }}">  {% else %}   40 {% endif %} 41 {% trans 'Change password' %}> a> /
>>
>> What do you think is the problem! I’ve been fighting with this for the
>> pas 15hrs yet no success. Kindly help me out!
>
> I don't spot any immediate reason for your problem. Some more
> information is needed. A full stacktrace is always really good if you
> happen to get one. Maybe the problem is in your admin.py. As said, it
> is hard to say without more information.
>
>  - Anssi
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: How to save a file from filesystem

2012-02-06 Thread Martin Tiršel

I found it:

myfile = File(open('/some/filesystem/path/file.jpg', 'r'))
myfile.name = os.path.basename(myfile.name)
myobj = MyObj.objects.get(id=123)
myobj.myfile = myfile
myobj.save()

This saves the file under upload_to path correctly.



On Mon, 06 Feb 2012 11:46:19 +0100, Martin Tiršel   
wrote:



Hello,

I have a model with FileField with upload_to callable to save it into  
secific directory structure. I have a list of paths on filesystem with  
some files I need to create a record for. How can I open a file on the  
filesystem, assign it to my model and save so the file will be copied to  
the path specified by upload_to callable?


Thanks,
Martin


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

2012-02-06 Thread akaariai
On Feb 6, 5:09 pm, coded kid  wrote:
> Hey guys, I’m getting an error when trying to visit my admin page:
> TemplateSyntaxError at /admin/
> Caught ImportError while rendering: No module named urls
>
> In urls.py
> from django.conf.urls.defaults import patterns, include, url
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
> (r'^admin/',include(admin.site.urls)),
> )
>
> In Template.py
>
>    
> {% block branding %}{% endblock %}
>   {% if user.is_active and user.is_staff %}
>    {% trans 'Welcome,' %}  {% filter
> force_escape %}{% firstof user.first_name user.username %}{% endfilter
> %}.
>  {% block userlinks %} {% url 'django-admindocs-docroot' as docsroot
> %}  {% if docsroot %}  {% trans
> 'Documentation' %} {% endif %}  {% url 'admin:password_change' as
> password_change_url %}  {% if password_change_url %} 37  href="{{ password_change_url }}">  {% else %}   40 {% endif %} 41 {% trans 'Change password' %} a> /
>
> What do you think is the problem! I’ve been fighting with this for the
> pas 15hrs yet no success. Kindly help me out!

I don't spot any immediate reason for your problem. Some more
information is needed. A full stacktrace is always really good if you
happen to get one. Maybe the problem is in your admin.py. As said, it
is hard to say without more information.

 - Anssi

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

2012-02-06 Thread akaariai
On Feb 6, 7:15 pm, Robert Lehmann  wrote:
> I'm trying to add additional data to an aggregated query, like so:
> (there are many MyModels for any date, and I want to sum up
> MyModel.value for every single date, and then do a calculation on that
> sum)
>
>   qs = MyModel.objects.values('date').annotate(count=Sum('value'))
>   for item in qs:
>       item['kilocount'] = item['count'] / 1000
>
> Now, it sounds reasonable to do that directly in the database:
>
> MyModel.objects.values('date').annotate(count=Sum('value')).extra(select={'kilocount':
> '"count" / 1000'))

> Is there no way to do this through the ORM on the database?
> (Another solution would probably be a custom template filter, but that
> doesn't strike me as too idiomatic.)

I don't see any way to do that currently. The ORM has little hope to
know this particular extra clause references an aggregate and thus
must not be put into the GROUP BY clause.

There is a ticket which would allow you to do this, but it will not
get into 1.4 for sure, and we will have to see what is the position of
core devs regarding adding more features to the ORM. It is pretty
complex already. Anyways, the ticket is #14030 (https://
code.djangoproject.com/ticket/14030).

I would just do that looping in code. It is simple and works. Someday
the ORM might be able to do that in the ORM, but not yet.

 - Anssi

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

2012-02-06 Thread Chris
It's unable to find the python module openid, I would assume, that you
just don't have the openid python module installed. Since you appear
to be using linux, you should just be able to, on the command line,
do:

pip install python-openid

And it should download and install the module.

On Feb 6, 7:59 am, xina towner  wrote:
> Hi, I get this errormessage and I don't understand why:
>
> File
> "/home/xino/.virtualenvs/xinovirtualenv/local/lib/python2.7/site-packages/d 
> jango/utils/importlib.py",
> line 35, in import_module
>     __import__(name)
>   File "/home/xino/workspace/unnamedapp/unnamedapp/social_auth/urls.py",
> line 4, in 
>     from views import auth, complete, associate, associate_complete, \
>   File "/home/xino/workspace/unnamedapp/unnamedapp/social_auth/views.py",
> line 22, in 
>     from social_auth.backends import get_backend
>   File
> "/home/xino/workspace/unnamedapp/unnamedapp/social_auth/backends/__init__.p 
> y",
> line 22, in 
>     from openid.consumer.consumer import Consumer, SUCCESS, CANCEL, FAILURE
> TemplateSyntaxError: Caught ImportError while rendering: No module named
> openid.consumer.consumer
>
> Does anybody know why?
>
> --
> Gràcies,
>
> Rubén

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



augmenting aggregated queries

2012-02-06 Thread Robert Lehmann
I'm trying to add additional data to an aggregated query, like so:
(there are many MyModels for any date, and I want to sum up
MyModel.value for every single date, and then do a calculation on that
sum)

  qs = MyModel.objects.values('date').annotate(count=Sum('value'))
  for item in qs:
  item['kilocount'] = item['count'] / 1000

Now, it sounds reasonable to do that directly in the database:

 
MyModel.objects.values('date').annotate(count=Sum('value')).extra(select={'kilocount':
'"count" / 1000'))

According to the docs and my tests, .values() discards all .extra()
queries:

"If you use a values() clause after an extra() call, any fields
defined by a select argument in the extra() must be explicitly
included in the values() call. Any extra() call made after a values()
call will have its extra selected fields ignored."

If I try to fix this as proposed in the last paragraph, I end up with
the following:

  MyModel.objects.extra(select={'kilocount': '"count" /
1000')).values('date', 'kilocount').annotate(count=Sum('value'))

which in turn raises a DatabaseError("misuse of aggregate: SUM()")
from an erroneous SQL query (in the GROUP BY part):

  SELECT ("count" / 1000) AS "kilocount", "mymodel"."date",
SUM("mymodel"."value") AS "count" FROM "mymodel" GROUP BY
"mymodel"."date", "mymodel"."date", ("count" / 1000)

Is there no way to do this through the ORM on the database?
(Another solution would probably be a custom template filter, but that
doesn't strike me as too idiomatic.)

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



Checking template

2012-02-06 Thread xina towner
How can I  check the template of a view??

can I do it like this:

def test_request_invitation(self):
resp = self.client.get('/accounts/invite/request/')
self.assertEqual(resp.status_code, 200)
self.assertTemplateUsed(resp, 'name_of_the_template', 'Bad
Template')


-- 
Gràcies,

Rubén

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

2012-02-06 Thread Pavlo Kapyshin
As this exception says, you have an error on first line of urls.py.
Double-check that line.

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



Django Tutorial Part 3 Decoupling the URLconfs

2012-02-06 Thread John Paton
Hi,

I have just tried to decouple my polls urls. Everything was working
before but when I now go to mysite I get the following error message.
Do you have any idea how I could fix this? Thanks for the help!

ImportError at /
cannot import name patterns
Request Method: GET
Request URL:http://127.0.0.1:8000/
Django Version: 1.3.1
Exception Type: ImportError
Exception Value:
cannot import name patterns
Exception Location: C:\Users\John\workspace\mysite\mysite\urls.py in
, line 1
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.2
Python Path:
['C:\\Users\\John\\workspace\\mysite\\mysite',
 'C:\\Users\\John\\workspace\\mysite',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Python27',
 'C:\\Python27\\lib\\site-packages',
 'C:\\Windows\\system32\\python27.zip']
Server time:Mon, 6 Feb 2012 11:56:28 -0500

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



Possible issue in Django's Wsgi.py module

2012-02-06 Thread Harel Malka
I've done a fairly standard release of our application last night and 
apache refused to start afterwards. This kept on going even after I rolled 
back the codebase. 
All I got back was Apache's server error page, and the logs showed the 
dreaded: 

*
*

*Premature end of script headers: django.wsgi*

I've gone through the whole debugging process, ruled out the usual suspects 
(expat etc.) and when I run the wsgi application via the python debuger I 
got back the following trace below. The error came from*
 django/core/handlers/wsgi.py(272)__call__()*:

batman:/home/harel# /usr/sbin/apache2 -X
['/usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg', 
'/usr/local/lib/python26.zip', '/usr/local/lib/python2.6', 
'/usr/local/lib/python2.6/plat-linux2', '/usr/local/lib/python2.6/lib-tk', 
'/usr/local/lib/python2.6/lib-old', '/usr/local/lib/python2.6/lib-dynload', 
'/usr/local/lib/python2.6/site-packages', 
'/usr/local/lib/python2.6/site-packages/PIL', '/home/glowconsole/', 
'/home/glowconsole/glowconsole/', 
'/usr/local/lib/python2.6/site-packages/django']
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(240)__call__()
-> from django.conf import settings
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(244)__call__()
-> if self._request_middleware is None:
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(245)__call__()
-> self.initLock.acquire()
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(246)__call__()
-> try:
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(247)__call__()
-> try:
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(249)__call__()
-> if self._request_middleware is None:
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(250)__call__()
-> self.load_middleware()
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(256)__call__()
-> self.initLock.release()
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(258)__call__()
-> set_script_prefix(base.get_script_name(environ))
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(259)__call__()
-> signals.request_started.send(sender=self.__class__)
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(260)__call__()
-> try:
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(261)__call__()
-> try:
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(262)__call__()
-> request = self.request_class(environ)
(Pdb) n
> /usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py(272)__call__()
-> response = self.get_response(request)
(Pdb) l
267 'status_code': 400,
268 }
269 )
270 response = http.HttpResponseBadRequest()
271 else:
272  -> *response = self.get_response(request)*
273 finally:
274 signals.request_finished.send(sender=self.__class__)
275 
276 try:
277 status_text = STATUS_CODE_TEXT[response.status_code]
(Pdb) n
Segmentation fault


I've got more information in this StackOverflow question: 
http://stackoverflow.com/questions/9158776/django-wsgi-apache-throws-premature-end-of-script-errors-and-none-of-the-usual-s

I've been batting my head agains the wall since midnight last night. No 
sleep till this is sorted.
Any ideas? I can't get why this would segfault apache.

Thanks,
Harel

-- 
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/-/Hv7-Dne0fCQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Is there a way to prevent /static directory browsing?

2012-02-06 Thread Robert Steckroth
Thanks much guys. +1 Django community.

On Mon, Feb 6, 2012 at 9:59 AM, Denis Darii  wrote:

> Under nginx you can set "autoindex" to "off" for "/static/" location:
>
> location /static/
> {
> autoindex off;
> root /path/to/your/static/;
> }
>
> More info here: http://wiki.nginx.org/HttpAutoindexModule
>
> On Mon, Feb 6, 2012 at 3:53 PM, Robert Steckroth <
> robertsteckr...@gmail.com> wrote:
>
>> Hey Guys, I am looking for a way to hide my media files from
>> direct access. What is the common practice here?
>> If one would browse to http://www.example.com/static in one of my Django
>> sites there would be
>> a list of all the files used therein. Is there a way to hide/prevent this
>> url from having a directory tree?
>>
>> --
>> Bust0ut Surgemcgee  ---
>> BudTVNetwork.com
>> RadioWeedShow.com
>> PBDefence.com
>> "Bringing entertainment to Unix"
>> "Finding the exit without looking"
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> This e-mail and any file transmitted with it is intended only for the
> person or entity to which is addressed and may contain information that is
> privileged, confidential or otherwise protected from disclosure. Copying,
> dissemination or use of this e-mail or the information herein by anyone
> other than the intended recipient is prohibited. If you are not the
> intended recipient, please notify the sender immediately by return e-mail,
> delete this communication and destroy all copies.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Bust0ut Surgemcgee  ---
BudTVNetwork.com
RadioWeedShow.com
PBDefence.com
"Bringing entertainment to Unix"
"Finding the exit without looking"

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

2012-02-06 Thread Vikas Ruhil
Sorry guys i forget to remove my signature extremely sorry for that to all

On Mon, Feb 6, 2012 at 8:40 PM, Vikas Ruhil  wrote:

> sure soon i must update my blog with my .vimrc on github ,pastie.org.I am
> busy in production of image and screen-cast for those plugins so people can
> benefited from them because vim really enhance the productivity and saves a
> lot of time. Can be converted into best editor .Many textmate and others
> users (pydev+eclipse ) mail me personally for Video because  they find it
> worthy.
> I am preparing first stuff for Dajngo/Python  later .For
> ruby,c,c++,java,prolog,haskell,lua..etc.
> I am using vim for all these from a long time whyn't we share our
> knowledge so community can be benefited.Thanks for good response and
> feedback from guys,Folks. I try to put my more effort soon update the blog
> with moving graphics so people can understand this with deep
>
> Regards
> Viaksh ruhil
>
>
> On Mon, Feb 6, 2012 at 8:24 PM, Piotr Zalewa  wrote:
>
>> Good work with adding explanations to what plugins are doing, I'm too
>> often just add plugins.
>>
>> It might be worth to put your setup (basically .vim directory) on github.
>> I did so with mine, but it's a bit bloated (https://github.com/zalun/**
>> vimSetup )
>>
>> I advice to use pathogen plugin and keep all submodules in "bundle" dir.
>> It's de facto standard in vim configs.
>>
>> zalun
>>
>>
>> On 02/04/12 20:49, David Markey wrote:
>>
>>> It looks like most of this could be scripted to be made automatic..
>>>
>>> On 4 February 2012 19:31, yati sagade >> **> wrote:
>>>
>>>Seriously dude, I think you should go about making a video of this.
>>>
>>>
>>>On Sun, Feb 5, 2012 at 12:56 AM, Vikas Ruhil >>> wrote:
>>>
>>>
>>>Now working on graphics and how use all this content efficiently
>>>,try to make graphics those can give basic to advance
>>>understanding to the Python/Django users.Really Good response
>>>this post is breaking records for m .Keep Switch there More are
>>>coming
>>>
>>>On Sun, Feb 5, 2012 at 12:29 AM, yati sagade
>>>mailto:yati.sag...@gmail.com>**> wrote:
>>>
>>>Hi Vikash
>>>Appreciate the heads up! Why don't you share this link on G+
>>>and other social media - Even I'll share with my friends - I
>>>haven't tried all of it yet, but it looks good. kudos man,
>>>Good Job! Keep it up :)
>>>
>>>Yati Sagade
>>>
>>>On Sat, Feb 4, 2012 at 5:33 PM, Vikas Ruhil
>>>mailto:vikasruhi...@gmail.com**>>
>>> wrote:
>>>
>>>I write a Blog about VIM as a Python/Dajngo Modern IDE
>>>.There are about 15 Plugin and config of there is on
>>>post . I am looking for plugin suggestion for more .
>>>
>>>Also for newbie and Non-vim user's there is request  to
>>>checkout the post.Those Guys who ask what IDE should
>>>they need use or Which is Best IDE for Python/Django.
>>>
>>>http://learnhackstuff.**blogspot.in/2012/02/vim-as-**
>>> universal-idepart-1.html
>>>
>>>Regards
>>>Vikash Ruhil
>>>
>>>--
>>>You received this message because you are subscribed to
>>>the Google Groups "Django users" group.
>>>To post to this group, send email to
>>>django-users@googlegroups.com
>>>
>>> >> >.
>>>
>>>To unsubscribe from this group, send email to
>>>
>>> django-users+unsubscribe@**googlegroups.com
>>>
>>> >> **>.
>>>
>>>For more options, visit this group at
>>>
>>> http://groups.google.com/**group/django-users?hl=en
>>> .
>>>
>>>
>>>
>>>
>>>--
>>>Yati 
>>> Sagade
>>> >
>>>
>>>(@yati_itay **)
>>>
>>>
>>>
>>>--
>>>You received this message because you are subscribed to the
>>>Google Groups "Django users" group.
>>>To post to this group, send email to
>>>django-users@googlegroups.com
>>>
>>> >> >.
>>>
>>>To unsubscribe from this group, send email to
>>>
>>> django-users+unsubscribe@**googlegroups.com
>>>
>>> >> **>.
>>>
>>>For more options, visit this group at
>>>
>>> http://groups.google.com/**group/django-users?

Re: VIM as Modern Python/Dajngo IDE

2012-02-06 Thread Vikas Ruhil
sure soon i must update my blog with my .vimrc on github ,pastie.org.I am
busy in production of image and screen-cast for those plugins so people can
benefited from them because vim really enhance the productivity and saves a
lot of time. Can be converted into best editor .Many textmate and others
users (pydev+eclipse ) mail me personally for Video because  they find it
worthy.
I am preparing first stuff for Dajngo/Python  later .For
ruby,c,c++,java,prolog,haskell,lua..etc.
I am using vim for all these from a long time whyn't we share our knowledge
so community can be benefited.Thanks for good response and feedback from
guys,Folks. I try to put my more effort soon update the blog with moving
graphics so people can understand this with deep

Regards
Viaksh ruhil

On Mon, Feb 6, 2012 at 8:24 PM, Piotr Zalewa  wrote:

> Good work with adding explanations to what plugins are doing, I'm too
> often just add plugins.
>
> It might be worth to put your setup (basically .vim directory) on github.
> I did so with mine, but it's a bit bloated (https://github.com/zalun/**
> vimSetup )
>
> I advice to use pathogen plugin and keep all submodules in "bundle" dir.
> It's de facto standard in vim configs.
>
> zalun
>
>
> On 02/04/12 20:49, David Markey wrote:
>
>> It looks like most of this could be scripted to be made automatic..
>>
>> On 4 February 2012 19:31, yati sagade > **> wrote:
>>
>>Seriously dude, I think you should go about making a video of this.
>>
>>
>>On Sun, Feb 5, 2012 at 12:56 AM, Vikas Ruhil >> wrote:
>>
>>
>>Now working on graphics and how use all this content efficiently
>>,try to make graphics those can give basic to advance
>>understanding to the Python/Django users.Really Good response
>>this post is breaking records for m .Keep Switch there More are
>>coming
>>
>>On Sun, Feb 5, 2012 at 12:29 AM, yati sagade
>>mailto:yati.sag...@gmail.com>**> wrote:
>>
>>Hi Vikash
>>Appreciate the heads up! Why don't you share this link on G+
>>and other social media - Even I'll share with my friends - I
>>haven't tried all of it yet, but it looks good. kudos man,
>>Good Job! Keep it up :)
>>
>>Yati Sagade
>>
>>On Sat, Feb 4, 2012 at 5:33 PM, Vikas Ruhil
>>mailto:vikasruhi...@gmail.com**>>
>> wrote:
>>
>>I write a Blog about VIM as a Python/Dajngo Modern IDE
>>.There are about 15 Plugin and config of there is on
>>post . I am looking for plugin suggestion for more .
>>
>>Also for newbie and Non-vim user's there is request  to
>>checkout the post.Those Guys who ask what IDE should
>>they need use or Which is Best IDE for Python/Django.
>>
>>http://learnhackstuff.**blogspot.in/2012/02/vim-as-**
>> universal-idepart-1.html
>>
>>Regards
>>Vikash Ruhil
>>
>>--
>>You received this message because you are subscribed to
>>the Google Groups "Django users" group.
>>To post to this group, send email to
>>django-users@googlegroups.com
>>
>> > >.
>>
>>To unsubscribe from this group, send email to
>>
>> django-users+unsubscribe@**googlegroups.com
>>
>> > **>.
>>
>>For more options, visit this group at
>>
>> http://groups.google.com/**group/django-users?hl=en
>> .
>>
>>
>>
>>
>>--
>>Yati 
>> Sagade
>> >
>>
>>(@yati_itay **)
>>
>>
>>
>>--
>>You received this message because you are subscribed to the
>>Google Groups "Django users" group.
>>To post to this group, send email to
>>django-users@googlegroups.com
>>
>> > >.
>>
>>To unsubscribe from this group, send email to
>>
>> django-users+unsubscribe@**googlegroups.com
>>
>> > **>.
>>
>>For more options, visit this group at
>>
>> http://groups.google.com/**group/django-users?hl=en
>> .
>>
>>
>>
>>
>>Regards
>>Vikash Ruhil
>>
>>--
>>You received this message because you are subscribed to the
>>Google Groups "Django users" group.
>>To post to this group

Re: Is there a way to prevent /static directory browsing?

2012-02-06 Thread Denis Darii
Under nginx you can set "autoindex" to "off" for "/static/" location:

location /static/
{
autoindex off;
root /path/to/your/static/;
}

More info here: http://wiki.nginx.org/HttpAutoindexModule

On Mon, Feb 6, 2012 at 3:53 PM, Robert Steckroth
wrote:

> Hey Guys, I am looking for a way to hide my media files from
> direct access. What is the common practice here?
> If one would browse to http://www.example.com/static in one of my Django
> sites there would be
> a list of all the files used therein. Is there a way to hide/prevent this
> url from having a directory tree?
>
> --
> Bust0ut Surgemcgee  ---
> BudTVNetwork.com
> RadioWeedShow.com
> PBDefence.com
> "Bringing entertainment to Unix"
> "Finding the exit without looking"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

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



Re: Is there a way to prevent /static directory browsing?

2012-02-06 Thread Cherian Thomas
Direct your webserver to prevent this. .htaccess/conf in apace. Directory
browsing is disabled by default in nginx
http://www.ducea.com/2006/06/26/apache-tips-tricks-disable-directory-indexes/


Regards,
Cherian



On Mon, Feb 6, 2012 at 8:23 PM, Robert Steckroth
wrote:

> Hey Guys, I am looking for a way to hide my media files from
> direct access. What is the common practice here?
> If one would browse to http://www.example.com/static in one of my Django
> sites there would be
> a list of all the files used therein. Is there a way to hide/prevent this
> url from having a directory tree?
>
> --
> Bust0ut Surgemcgee  ---
> BudTVNetwork.com
> RadioWeedShow.com
> PBDefence.com
> "Bringing entertainment to Unix"
> "Finding the exit without looking"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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.



Is there a way to prevent /static directory browsing?

2012-02-06 Thread Robert Steckroth
Hey Guys, I am looking for a way to hide my media files from direct access.
What is the common practice here?
If one would browse to http://www.example.com/static in one of my Django
sites there would be
a list of all the files used therein. Is there a way to hide/prevent this
url from having a directory tree?

-- 
Bust0ut Surgemcgee  ---
BudTVNetwork.com
RadioWeedShow.com
PBDefence.com
"Bringing entertainment to Unix"
"Finding the exit without looking"

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

2012-02-06 Thread Piotr Zalewa
Good work with adding explanations to what plugins are doing, I'm too 
often just add plugins.


It might be worth to put your setup (basically .vim directory) on 
github. I did so with mine, but it's a bit bloated 
(https://github.com/zalun/vimSetup)


I advice to use pathogen plugin and keep all submodules in "bundle" dir. 
It's de facto standard in vim configs.


zalun

On 02/04/12 20:49, David Markey wrote:

It looks like most of this could be scripted to be made automatic..

On 4 February 2012 19:31, yati sagade mailto:yati.sag...@gmail.com>> wrote:

Seriously dude, I think you should go about making a video of this.


On Sun, Feb 5, 2012 at 12:56 AM, Vikas Ruhil mailto:vikasruhi...@gmail.com>> wrote:


Now working on graphics and how use all this content efficiently
,try to make graphics those can give basic to advance
understanding to the Python/Django users.Really Good response
this post is breaking records for m .Keep Switch there More are
coming

On Sun, Feb 5, 2012 at 12:29 AM, yati sagade
mailto:yati.sag...@gmail.com>> wrote:

Hi Vikash
Appreciate the heads up! Why don't you share this link on G+
and other social media - Even I'll share with my friends - I
haven't tried all of it yet, but it looks good. kudos man,
Good Job! Keep it up :)

Yati Sagade

On Sat, Feb 4, 2012 at 5:33 PM, Vikas Ruhil
mailto:vikasruhi...@gmail.com>> wrote:

I write a Blog about VIM as a Python/Dajngo Modern IDE
.There are about 15 Plugin and config of there is on
post . I am looking for plugin suggestion for more .

Also for newbie and Non-vim user's there is request  to
checkout the post.Those Guys who ask what IDE should
they need use or Which is Best IDE for Python/Django.


http://learnhackstuff.blogspot.in/2012/02/vim-as-universal-idepart-1.html

Regards
Vikash Ruhil

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




--
Yati Sagade

(@yati_itay )


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




Regards
Vikash Ruhil

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




--
Yati Sagade

(@yati_itay )


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

How to check the HTTP_HOST from templates/404.html when using flat pages

2012-02-06 Thread tiff
Hi,
I am using flatpages and I have a 404.html in my templates directory.
I need the 404 page to extend different templates depending on the
HTTP_HOST (the same app is delivering pages for multiple domains).
What's the easiest way to achieve this from the 404 page without
overriding the 404 handler?
Is there a built in tagname?
TIA
Steve

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

2012-02-06 Thread Denis Darii
Yes Rubén you are right,
also you can use directly self.client.login() method:

...

def setUp(self):login =
self.client.login(username='myusername', password='mypass')
self.assertTrue(login)


On Mon, Feb 6, 2012 at 12:46 PM, xina towner  wrote:

> Hi, I've a question, how can I make login while testing? shouldn't be
> enough to do something like this:
>
> def setUp(self):
> response = self.post('/accounts/login/', {'username': 'username',
> 'password': 'username'})
> self.assertEqual(response.status_code, 200, "Login Failure")
> pass
>
> I understand that this setUp makes login before every test. Can you tell
> me if I am right?
>
> --
> Gràcies,
>
> Rubén
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

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



Making login Testing

2012-02-06 Thread xina towner
Hi, I've a question, how can I make login while testing? shouldn't be
enough to do something like this:

def setUp(self):
response = self.post('/accounts/login/', {'username': 'username',
'password': 'username'})
self.assertEqual(response.status_code, 200, "Login Failure")
pass

I understand that this setUp makes login before every test. Can you tell me
if I am right?

-- 
Gràcies,

Rubén

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



Release: django-email-as-username

2012-02-06 Thread Tom Christie
Okay, I know there are a handful of other apps that already do this, but I 
wasn't quite happy with anything that was out there.

I've pushed the django-email-as-username package to PyPI.

Source and docs available 
here: https://github.com/dabapps/django-email-as-username

I think it's pretty comprehensive...

1. Provides an email auth backend and helper functions for creating users.
2. Patches the Django admin to handle email based user authentication.
3. Overides the `createsuperuser` command to create users with email only. 
 (Eg during initial `syncdb`)
4. Treats email authentication as case-insensitive.

There's a few outstanding tickets for extra little tweaks to improve things 
even more, such as providing a migration for adding it to existing projects 
and so on.
Would appreciate any forks/ideas for improvements etc.etc.

Cheers,

  Tom

-- 
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/-/y8iZz4io3gUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to save a file from filesystem

2012-02-06 Thread Martin Tiršel

Hello,

I have a model with FileField with upload_to callable to save it into  
secific directory structure. I have a list of paths on filesystem with  
some files I need to create a record for. How can I open a file on the  
filesystem, assign it to my model and save so the file will be copied to  
the path specified by upload_to callable?


Thanks,
Martin

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



Re: how to make a small change for apps installed under /site-packages dir

2012-02-06 Thread bruno desthuilliers
On Feb 5, 6:16 pm, Tom Lesters  wrote:
> hi all,
>
> I installed an app called idios into python2.6/site-packages/idios dir,

Which is possibly not a great idea... as you now know .

Generally speaking, using virtualenv (no-site-packages) + pip (with a
requirement file you keep in your project) is a GoodPractice(tm) when
it comes to dependencies.

> now I need to make a small change, adding the following line(just for
> purpose of explaining this question)
> @login_required
> to one of the functions defined in idios/views.py

Daniel already provided the simplest solution for this problem. For
more involved changes and assuming you prefer not to mess with the
third part app's code, you can also monkeypatch the relevant functions
in your own app.

> or it's just the nature of any django apps:
> if you need to modify anything in the urls.py ,views.py or models.py,
> you just grab the source and make is as a local project app?

Depends on how much you need to modify the third part app. Forking the
app is sometimes the best solution, but it means you'll have a hard
time keeping in sync with the original code when bugfixes and new
features will be released. Monkeypatching doesn't totally solve this
problem but from experience it makes for easier updates.

My 2 cents...

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