Re: error in sql..

2013-03-20 Thread Bulkan
Hi there,

Looks like the EXISTS part in your sql is wrong as it needs another sub
query. See the documentation at [1]

1 -
http://dev.mysql.com/doc/refman/5.0/en/exists-and-not-exists-subqueries.html

Cheers

http://bulkan-evcimen.com


On Thu, Mar 21, 2013 at 4:25 PM, Avnesh Shakya wrote:

>
> Hi,i m facing problem in mysql line, plz help me,i m unable to get
> solution...
>
> import MySQLdb
> import urllib
> import json
> from bs4 import BeautifulSoup
> tdd=json.loads(urllib.urlopen('
> https://www.coursera.org/maestro/api/topic/list2').read())
> tsl=tdd['unis']
>
> try:
> conn=MySQLdb.connect(host="127.0.0.1",
> user="root",
> passwd="avnesh27",
> db="course_detail",port=3306)
> x= conn.cursor()
> result = []
> for i in range(len(tsl)):
> home_link = tsl[i]['home_link']
> cor_id = tsl[i]['id']
> name = tsl[i]['name']
> sql = "Select uni_id , name from universities where EXISTS(uni_id =
> cor_id and name = name"
> result = x.execute(sql)
> if (result):
> sql = "insert into universites (uni_id, home_link,name) values(%d,
> %s, %s)" %(cor_id, home_link, name)
> x.execute(sql)
>
> conn.commit()
> conn.close()
> except Exception, e:
> print "Error %s" % e
>
>
> error is--
> Error (1064, "You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use near
> 'uni_id = cor_id and name = name' at line 1")
>
>  --
> 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.




error in sql..

2013-03-20 Thread Avnesh Shakya

Hi,i m facing problem in mysql line, plz help me,i m unable to get 
solution...

import MySQLdb
import urllib
import json
from bs4 import BeautifulSoup
tdd=json.loads(urllib.urlopen('https://www.coursera.org/maestro/api/topic/list2').read())
tsl=tdd['unis']

try:
conn=MySQLdb.connect(host="127.0.0.1",
user="root",
passwd="avnesh27",
db="course_detail",port=3306)
x= conn.cursor()
result = []
for i in range(len(tsl)):
home_link = tsl[i]['home_link']
cor_id = tsl[i]['id']
name = tsl[i]['name']
sql = "Select uni_id , name from universities where EXISTS(uni_id = 
cor_id and name = name"
result = x.execute(sql)
if (result):
sql = "insert into universites (uni_id, home_link,name) values(%d, 
%s, %s)" %(cor_id, home_link, name)
x.execute(sql)

conn.commit()
conn.close()
except Exception, e:
print "Error %s" % e


error is--
Error (1064, "You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near 
'uni_id = cor_id and name = name' at line 1")

-- 
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: PostgresSQL or MySql with django?

2013-03-20 Thread Jian Chang
postgres!
do what you like

2013/3/18 frocco 

> Hello,
>
> What is the recommended database for django?
>
> I have used MySQL, but am interested in Postgres.
>
> 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: Can Django do this?

2013-03-20 Thread Rodrigo Morgado
I prefer not using flash and developing agile.

Without problem you can do that :)

Cheers,
El 20/03/2013 22:26, "Harry Ord"  escribió:

> Hello
>
>  Can i create a website just like this with Django?
>
> http://www.hbn.cl/
>
> --
> 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 Django do this?

2013-03-20 Thread Bulkan
Yes you certainly can. Here is the tutorial to get you started

https://docs.djangoproject.com/en/1.5/intro/tutorial01/


On Thu, Mar 21, 2013 at 1:25 PM, Harry Ord  wrote:

> Hello
>
>  Can i create a website just like this with Django?
>
> http://www.hbn.cl/
>
> --
> 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 Django do this?

2013-03-20 Thread Harry Ord
Hello

 Can i create a website just like this with Django?

http://www.hbn.cl/

-- 
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: Goodbye, Malcolm

2013-03-20 Thread Kurtis Mullins
R.I.P.


On Wed, Mar 20, 2013 at 8:16 PM, Ray Loyzaga  wrote:

> Hi Jacob,
>
> Would you be able to email me regarding the future funeral arrangements for
> Malcolm.
> So far the family are looking at 4th April, in Sydney, but the time (and
> the date), haven't been totally settled.
> It would be great if your could update the notice to include the details,
> as his family is not in contact with his wider group of friends.
>
> rloyz...@gmail.com
>
>
> On Wednesday, March 20, 2013 4:01:39 AM UTC+11, Jacob Kaplan-Moss wrote:
>>
>> Hello fellow Djangonauts,
>>
>> We have difficult news: Malcolm Tredinnick has passed away.
>>
>> Malcolm was a long-time contributor to Django, a model community member,
>> a brilliant mind, and a friend. His contributions to Django — and to
>> many other open source projects — are nearly impossible to enumerate.
>> Many on the core Django team had their first patches reviewed by him;
>> his mentorship enriched us. His consideration, patience, and dedication
>> will always be an inspiration to us.
>>
>> To say we'll miss him is an understatement.
>>
>> Our thoughts are with Malcolm's friends, colleagues, and family at this
>> difficult time.
>>
>> This came as quite a shock, and we're still sorting out details. We'll
>> update our blog,
>> https://www.djangoproject.com/**weblog/2013/mar/19/goodbye-**malcolm/,
>>
>> once we know the details of how you can express your condolences to
>> Malcolm's friends and family.
>>
>> — The Django Core Team
>>
>  --
> 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.




Best practice for making AJAX-heavy Django pages crawlable?

2013-03-20 Thread rogueleaderr
Hi everyone!

Here's my problem. I seem to have made a rookie mistake that is preventing 
Google for indexing my site and I'm trying to figure out how to fix that.

I made a Django-powered site that dynamically builds pages by stitching 
together information from my database with a bunch of external API calls. 
Because the API's take unpredictable amounts of time to return, I built the 
site so that Django receives a URL and returns a minimal HTML page with a 
bunch of named empty . I then use jQuery to make a bunch of calls 
back to my Django server, asking it to hit the API's and process the 
returned data and return the results to the client as JSON. The JSON then 
gets inserted into the div's and the page gets filed with content.

I realize that this is a bit of an stretch of the normal Django paradigm, 
but I found that this process really improves my perceived page load speed 
since minimal page renders immediately and the user can start reading 
fast-loading content while waiting for the slower API's to finish.

The problem is that by default, Google et al. only index the HTML page the 
server initially returns, which is mostly blank. 

So the question is how best to make Google index the full, content rich 
page instead. I've been researching for a couple of hours and it looks like 
Google has instructions for  how they normally deal with AJAX'y pages (
https://developers.google.com/webmasters/ajax-crawling/docs/getting-started). 
But they mostly suggest replacing hashes with hashbangs; I'm not using 
hashes (maybe I'm doing this AJAX wrong...) so I'm not sure that applies to 
me. 

The other option is to put a  tag in the 
head of the HTML, which will cause the crawler to request www.example.com*
?_escaped_fragment_*, and then somehow redirect that request to a different 
view that generates a complete static version of the pages completely in 
python. I imagine that could be done either by rejiggering the code or by 
using some sort of headless browser (perhaps even the Django testing 
client.)

Anyway, before I spend a long time hacking on a solution I just wanted to 
check if this is a solved problem with an easy way out (or whether I've 
just screwed myself and and need to start digging my way out.)

Thoughts?

Thanks!
-George

-- 
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: 1.5 custom user model: Add User with default UserCreationForm results in "no such table: auth_user"

2013-03-20 Thread scottanderso...@gmail.com

On Friday, March 1, 2013 2:51:50 AM UTC-5, Russell Keith-Magee wrote:
>
> The good news is that you can still re-use the form logic in those two 
> forms -- a form is just a class, so you can subclass them. If you User 
> model subclasses AbstractUser, all the core fields have the same name and 
> constraints, so all you need to do is redeclare the Meta portion of the 
> class definition (to bind your subclass to your actual User model). This 
> way you get all the logic for password/username checks, and the custom 
> save() methods, but against your own model and field list.
>
>  
This isn't quite enough, unfortunately. I'm not sure if this is a bug, an 
oversight, or part of the "little more complicated", but UserCreationForm 
doesn't use the model from Meta:

class UserCreationForm(forms.ModelForm):
[...]
class UserCreationForm(forms.ModelForm):
def clean_username(self):
# Since User.username is unique, this check is redundant,
# but it sets a nicer error message than the ORM. See #13147.
username = self.cleaned_data["username"]
try:
*User._default_manager.get(username=username)*
except *User.DoesNotExist:*
return username
raise 
forms.ValidationError(self.error_messages['duplicate_username'])

Here's what I had to do in addition to adding a Meta override:

from django import forms
from django.contrib import admin
from django.contrib.auth.forms import UserCreationForm, UserChangeForm

from member.models import Member

from django.contrib.auth.admin import UserAdmin

class MemberCreationForm(UserCreationForm):
def clean_username(self):
username = self.cleaned_data["username"]
try:
# Not sure why UserCreationForm doesn't do this in the first 
place,
# or at least test to see if _meta.model is there and if not 
use User...
*self._meta.model._default_manager.get(username=username)*
except *self._meta.model.DoesNotExist*:
return username
raise 
forms.ValidationError(self.error_messages['duplicate_username'])

class Meta:
model = Member
fields = ("username",)

class MemberChangeForm(UserChangeForm):
class Meta:
model = Member

class MemberAdmin(UserAdmin):
form = MemberChangeForm
add_form = MemberCreationForm

admin.site.register(Member, MemberAdmin)

-- 
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: Goodbye, Malcolm

2013-03-20 Thread Ray Loyzaga
Hi Jacob,

Would you be able to email me regarding the future funeral arrangements for
Malcolm.
So far the family are looking at 4th April, in Sydney, but the time (and
the date), haven't been totally settled.
It would be great if your could update the notice to include the details,
as his family is not in contact with his wider group of friends.

rloyz...@gmail.com


On Wednesday, March 20, 2013 4:01:39 AM UTC+11, Jacob Kaplan-Moss wrote:
>
> Hello fellow Djangonauts, 
>
> We have difficult news: Malcolm Tredinnick has passed away. 
>
> Malcolm was a long-time contributor to Django, a model community member, 
> a brilliant mind, and a friend. His contributions to Django — and to 
> many other open source projects — are nearly impossible to enumerate. 
> Many on the core Django team had their first patches reviewed by him; 
> his mentorship enriched us. His consideration, patience, and dedication 
> will always be an inspiration to us. 
>
> To say we'll miss him is an understatement. 
>
> Our thoughts are with Malcolm's friends, colleagues, and family at this 
> difficult time. 
>
> This came as quite a shock, and we're still sorting out details. We'll 
> update our blog, 
> https://www.djangoproject.com/weblog/2013/mar/19/goodbye-malcolm/, 
> once we know the details of how you can express your condolences to 
> Malcolm's friends and family. 
>
> — The Django Core Team 
>

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

2013-03-20 Thread Felipe Coelho
>
> 2013/3/20 Larry Martell 


> I'm not outputting any PDF. I have a zip file I want to download to
> the user's computer, and I also want my template rendered.


That means you have should have two requests, possibly processed by two
different views, which is what Felipe (the other one) is trying to tell you.

You must have a view that renders your template. In the resulting page,
include something to trigger the file
downloadfrom
the other view.

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

2013-03-20 Thread Russell Keith-Magee
On Thu, Mar 21, 2013 at 5:18 AM, Casey Greene
wrote:

> Does anyone have a standard way of citing Django? This ticket:
> https://code.djangoproject.com/ticket/15379
> seems to indicate that the preferred way might be:
> Django core team (2011). Django: A Web framework for the Python
> programming language. Django Software Foundation, Lawrence, Kansas,
> U.S.A. URL http://www.djangoproject.com
>
> I'm happy to go with that, but I'd like confirmation that that's the
> preferred way to go. Thus far we've used Django quite a bit (e.g. its
> used by both http://imp.princeton.edu and http://pilgrm.princeton.edu
> ) but it hasn't been cited or discussed in the technical parts of
> these papers. We do, however, cite R and its packages when we use
> those methods, since there's a commonly accepted way to do so.
> Providing this readily might help Django gain additional traction in
> the academic community (i.e. with regular mentions of the framework
> and evidence of its appropriateness for various tasks).
>
>
There isn't an "official" citation format, for two reasons: citation
formats can vary wildly between publications, and citation standards for
software are still a matter of some debate.

APA style [1], for example, would dictate something like:

Django (Version 1.5) [Computer Software]. (2013). Retrieved from
http://djangoproject.com

However, the only true guide is what your publisher will accept. I'd
suggest getting hold of your publishers guidelines, and filling in the gaps
as best you can.

If your referencing style guide requires a publisher name, use "Django
Software Foundation".

If you need a publishing location, use "Lawrence, Kansas".

If you need a web address, use http://djangoproject.com

If you need a name, just use "Django", without any tagline.

If you need a publication date, use the year of release of the version
you're referencing (e.g., 2013 for v1.5)

Beyond, that, fill in as seems appropriate for your needs.

[1]
http://www.usq.edu.au/library/referencing/apa-referencing-guide#Other_electronic_media

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: Apache JQuery deployment advice

2013-03-20 Thread Michael Pimmer

Have you ever worked with anything like SVN or GIT?

Templates are a very basic and useful thing, make sure you know what 
Django offers and why you don't want to use it.

As already mentioned: take a look at django South, too.



On 21/03/13 05:28, Sells, Fred wrote:


I'm converting a Java jnlp app with a tomcat backend to an 
HTML5/jQuery/AJAX UI with a Django/Apache backend.


This is an intranet application with <50 users and a very light 
workload.  Idle 90% of the time and ~5 users active at a time.  There 
are only 2 or 3 pages in the entire project. I don't think I need 
templates at all but can handle it with one static HTML page and AJAX, 
using jQuery's .load() function to assemble the "components" combined 
with a tabnavigator to change views.


While this application is not very "busy" it is very complex and the 
requirements change frequently.


My concern is coming up with a deploy strategy that makes it easy to 
manage upgrades and the occasional revert when an upgrade is buggy.  
And yes I know it should be tested better, but there are internal 
issues that prevent that.


All my prior apps have used Adobe's Flex/Flash for client,  XML for 
data transfer and Apache/Django 1.3/MySQL for the server.  In those 
applications I would use a "daisy chain" of symlinks to point to the 
current deploy like this


Maindeploydir

/v001

/v002

...

/v099

/current -> v099

Under htdocs and under my wsgi directory I would have symlinks that 
point to /home/maindeploydir/current/gui  and 
/home/maindeploydir/current/mydjangosite respectively


Thus a new deployment just involves changes the "current" symlink.

This seemed reasonable when the client was build using the Flex IDE 
and the server was built using Eclipse/PyDev.  But now that I'm 
abandoning Flex, I think there should be a better way.  Perhaps my 
lack of experience with staticfiles is a factor in not seeing the 
light, but I would appreciate some insight into a sound deployment 
strategy.


Thanks,

Fred.

--
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: Changing User model

2013-03-20 Thread Lachlan Musicman
Hey, since I've got this working, I was going to explain it.

BUT, in teh intervening period, http://django-userena.org/ was bought
to my attention - I will read that coe first and potentially use.

cheers
L.



On 19 March 2013 12:29, Lachlan Musicman  wrote:
> On 18 March 2013 22:59, Sanjay Bhangar  wrote:
>> Hey L,
>>
>> On Mon, Mar 18, 2013 at 9:13 AM, Lachlan Musicman  wrote:
>>> Hola,
>>>
>>> For a new project, I will be creating a separate Profile class for all
>>>  information about my Users that isn't covered by User.
>>>
>>> One thing I did want though, was to change the login username to the
>>> email address.
>>>
>>> From what I've read in the code and docs, am I right in presuming that
>>> I can subclass AbstractUser and just change
>>>   USERNAME_FIELD = 'email'
>>> to get this result?
>>
>> That seemed to work, yes. The problem I had, though, was once I made
>
> Ok, it doesn't work.
>
> Because there is a need to redefine email - it needs to be unique=True
> and db_index=True, there's a clash with the underlying AbstractUser
> class.
>
> So, the options are now to add a second email field to the
> AbstractUser class, or to subclass the AbstractBaseUser class.
>
> The first option is easier and is less confusing code, although it
> does have the distinctly unattractive email2 (or whatever) rather than
> email as the index and USERNAME_FIELD.
>
> The second option is annoying (cut and paste AbstractUser from
> django.contrib.auth.models but fix email), but also seems like the
> correct solution.
>
> Gah. I bite the bullet and do option 2 at this stage.
>
> cheers
> L.
>
>
>
>> this change, adding users in the default admin became totally broken,
>> and I did not find a way to fix that easily. Please do let know if you
>> manage to do this in a way that doesn't break the admin functionality
>> to add users (if you don't get care about Admin to manage users, this
>> should work no problem .. ).
>
> --
> 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



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

On 19 March 2013 12:29, Lachlan Musicman  wrote:
> On 18 March 2013 22:59, Sanjay Bhangar  wrote:
>> Hey L,
>>
>> On Mon, Mar 18, 2013 at 9:13 AM, Lachlan Musicman  wrote:
>>> Hola,
>>>
>>> For a new project, I will be creating a separate Profile class for all
>>>  information about my Users that isn't covered by User.
>>>
>>> One thing I did want though, was to change the login username to the
>>> email address.
>>>
>>> From what I've read in the code and docs, am I right in presuming that
>>> I can subclass AbstractUser and just change
>>>   USERNAME_FIELD = 'email'
>>> to get this result?
>>
>> That seemed to work, yes. The problem I had, though, was once I made
>
> Ok, it doesn't work.
>
> Because there is a need to redefine email - it needs to be unique=True
> and db_index=True, there's a clash with the underlying AbstractUser
> class.
>
> So, the options are now to add a second email field to the
> AbstractUser class, or to subclass the AbstractBaseUser class.
>
> The first option is easier and is less confusing code, although it
> does have the distinctly unattractive email2 (or whatever) rather than
> email as the index and USERNAME_FIELD.
>
> The second option is annoying (cut and paste AbstractUser from
> django.contrib.auth.models but fix email), but also seems like the
> correct solution.
>
> Gah. I bite the bullet and do option 2 at this stage.
>
> cheers
> L.
>
>
>
>> this change, adding users in the default admin became totally broken,
>> and I did not find a way to fix that easily. Please do let know if you
>> manage to do this in a way that doesn't break the admin functionality
>> to add users (if you don't get care about Admin to manage users, this
>> should work no problem .. ).
>
> --
> 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



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




Citing Django

2013-03-20 Thread Casey Greene
Does anyone have a standard way of citing Django? This ticket:
https://code.djangoproject.com/ticket/15379
seems to indicate that the preferred way might be:
Django core team (2011). Django: A Web framework for the Python
programming language. Django Software Foundation, Lawrence, Kansas,
U.S.A. URL http://www.djangoproject.com

I'm happy to go with that, but I'd like confirmation that that's the
preferred way to go. Thus far we've used Django quite a bit (e.g. its
used by both http://imp.princeton.edu and http://pilgrm.princeton.edu
) but it hasn't been cited or discussed in the technical parts of
these papers. We do, however, cite R and its packages when we use
those methods, since there's a commonly accepted way to do so.
Providing this readily might help Django gain additional traction in
the academic community (i.e. with regular mentions of the framework
and evidence of its appropriateness for various tasks).

Thanks!
Casey

-- 
Casey Greene
Assistant Professor
Department of Genetics
Institute for Quantitative Biomedical Sciences
Norris Cotton Cancer Center
The Geisel School of Medicine at Dartmouth
Hanover, NH

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

2013-03-20 Thread Larry Martell
On Wed, Mar 20, 2013 at 3:01 PM, Felipe Prenholato  wrote:
> I mean, you output PDF.
> It's a simple view that output PDF, this view is called via ajax after page
> that show HTML loads.

I'm not outputting any PDF. I have a zip file I want to download to
the user's computer, and I also want my template rendered.


> 2013/3/20 Larry Martell 
>>
>> On Wed, Mar 20, 2013 at 2:27 PM, Felipe Prenholato 
>> wrote:
>> > When page loads (document.ready), do a ajax call to a view that returns
>> > PDF
>> > file.
>>
>> How is a PDF file involved here?
>>
>>
>> > 2013/3/20 Larry Martell 
>> >>
>> >> On Wed, Mar 20, 2013 at 5:34 AM, Tom Evans 
>> >> wrote:
>> >> > On Wed, Mar 20, 2013 at 11:28 AM, Larry Martell
>> >> >  wrote:
>> >> >> Yes, I have convinced them to not require this. Now my issue is how
>> >> >> to
>> >> >> cause a file to be saved and to also render a template. When I
>> >> >> return
>> >> >> this:
>> >> >>
>> >> >> response = HttpResponse('This is what I want to save')
>> >> >> response['Content-Type'] = 'application/gzip'
>> >> >> response['Content-disposition'] = 'Attachment;
>> >> >> filename=export.gzip'
>> >> >> return response
>> >> >>
>> >> >> my template is obviously not rendered. How can I do this and also
>> >> >> render my template at the same time?
>> >> >>
>> >> >
>> >> > Use render() shortcut to generate a response and set the appropriate
>> >> > attributes on it before returning the response. Eg:
>> >> >
>> >> >   response = render(request, 'my_template.html', { })
>> >> >   response['Content-Type'] = 'application/gzip'
>> >> >   response['Content-disposition'] = 'Attachment;
>> >> > filename=export.gzip'
>> >> >   return response
>> >>
>> >> This is downloading a file, but the file that gets downloaded is not
>> >> export.gzip, but instead is a copy of my rendered template and my
>> >> template is not rendered in my 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.
>> >>
>> >>
>> >
>> > --
>> > 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.
>>
>>
>
> --
> 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: save as

2013-03-20 Thread Felipe Prenholato
I mean, you output PDF.
It's a simple view that output PDF, this view is called via ajax after page
that show HTML loads.

Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://devwithpassion.com | http://chronosbox.org/blog
GitHub: http://github.com/chronossc/ | Twitter: http://twitter.com/chronossc


2013/3/20 Larry Martell 

> On Wed, Mar 20, 2013 at 2:27 PM, Felipe Prenholato 
> wrote:
> > When page loads (document.ready), do a ajax call to a view that returns
> PDF
> > file.
>
> How is a PDF file involved here?
>
>
> > 2013/3/20 Larry Martell 
> >>
> >> On Wed, Mar 20, 2013 at 5:34 AM, Tom Evans 
> >> wrote:
> >> > On Wed, Mar 20, 2013 at 11:28 AM, Larry Martell
> >> >  wrote:
> >> >> Yes, I have convinced them to not require this. Now my issue is how
> to
> >> >> cause a file to be saved and to also render a template. When I return
> >> >> this:
> >> >>
> >> >> response = HttpResponse('This is what I want to save')
> >> >> response['Content-Type'] = 'application/gzip'
> >> >> response['Content-disposition'] = 'Attachment;
> >> >> filename=export.gzip'
> >> >> return response
> >> >>
> >> >> my template is obviously not rendered. How can I do this and also
> >> >> render my template at the same time?
> >> >>
> >> >
> >> > Use render() shortcut to generate a response and set the appropriate
> >> > attributes on it before returning the response. Eg:
> >> >
> >> >   response = render(request, 'my_template.html', { })
> >> >   response['Content-Type'] = 'application/gzip'
> >> >   response['Content-disposition'] = 'Attachment; filename=export.gzip'
> >> >   return response
> >>
> >> This is downloading a file, but the file that gets downloaded is not
> >> export.gzip, but instead is a copy of my rendered template and my
> >> template is not rendered in my 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.
> >>
> >>
> >
> > --
> > 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.
>
>
>

-- 
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: Apache JQuery deployment advice

2013-03-20 Thread Felipe Prenholato
You can do deploy using git and git tags for version and south migration
scripts for db changes. v099 is a git tag in your repository. In some
automated way (check fabric). In my case I not gone to fabric yet, so I
have a bash script that do:

git reset --hard &&
  git pull && git checkout $1
  python manage.py migrate --delete-ghost-migrations &&
  python manage.py collectstatic -cl --noinput &&
  touch  $VIRTUALENV/tmp/restart.txt

$1 is a parameter, so it is like that: release_new_version v099.

Fabric is a much better way to work, but myself not migrated yet because
lack of time.

Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://devwithpassion.com | http://chronosbox.org/blog
GitHub: http://github.com/chronossc/ | Twitter: http://twitter.com/chronossc


2013/3/20 Sells, Fred 

>  I’m converting a Java jnlp app with a tomcat backend to an
> HTML5/jQuery/AJAX UI with a Django/Apache backend.
>
> ** **
>
> This is an intranet application with <50 users and a very light workload.
> Idle 90% of the time and ~5 users active at a time.  There are only 2 or 3
> pages in the entire project.  I don’t think I need templates at all but can
> handle it with one static HTML page and AJAX, using jQuery’s .load()
> function to assemble the “components” combined with a tabnavigator to
> change views.
>
> ** **
>
> While this application is not very “busy” it is very complex and the
> requirements change frequently.
>
> ** **
>
> My concern is coming up with a deploy strategy that makes it easy to
> manage upgrades and the occasional revert when an upgrade is buggy.  And
> yes I know it should be tested better, but there are internal issues that
> prevent that.
>
> ** **
>
> All my prior apps have used Adobe’s Flex/Flash for client,  XML for data
> transfer and Apache/Django 1.3/MySQL for the server.  In those applications
> I would use a “daisy chain” of symlinks to point to the current deploy like
> this
>
> ** **
>
> Maindeploydir
>
> /v001
>
>/v002
>
>…
>
>/v099
>
>/current -> v099
>
> ** **
>
> Under htdocs and under my wsgi directory I would have symlinks that point
> to /home/maindeploydir/current/gui  and
> /home/maindeploydir/current/mydjangosite respectively
>
> ** **
>
> Thus a new deployment just involves changes the “current” symlink.
>
> ** **
>
> This seemed reasonable when the client was build using the Flex IDE and
> the server was built using Eclipse/PyDev.  But now that I’m abandoning
> Flex, I think there should be a better way.  Perhaps my lack of experience
> with staticfiles is a factor in not seeing the light, but I would
> appreciate some insight into a sound deployment strategy.
>
> ** **
>
> Thanks,
>
> ** **
>
> Fred.
>
> ** **
>
> ** **
>
> --
> 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: save as

2013-03-20 Thread Larry Martell
On Wed, Mar 20, 2013 at 2:27 PM, Felipe Prenholato  wrote:
> When page loads (document.ready), do a ajax call to a view that returns PDF
> file.

How is a PDF file involved here?


> 2013/3/20 Larry Martell 
>>
>> On Wed, Mar 20, 2013 at 5:34 AM, Tom Evans 
>> wrote:
>> > On Wed, Mar 20, 2013 at 11:28 AM, Larry Martell
>> >  wrote:
>> >> Yes, I have convinced them to not require this. Now my issue is how to
>> >> cause a file to be saved and to also render a template. When I return
>> >> this:
>> >>
>> >> response = HttpResponse('This is what I want to save')
>> >> response['Content-Type'] = 'application/gzip'
>> >> response['Content-disposition'] = 'Attachment;
>> >> filename=export.gzip'
>> >> return response
>> >>
>> >> my template is obviously not rendered. How can I do this and also
>> >> render my template at the same time?
>> >>
>> >
>> > Use render() shortcut to generate a response and set the appropriate
>> > attributes on it before returning the response. Eg:
>> >
>> >   response = render(request, 'my_template.html', { })
>> >   response['Content-Type'] = 'application/gzip'
>> >   response['Content-disposition'] = 'Attachment; filename=export.gzip'
>> >   return response
>>
>> This is downloading a file, but the file that gets downloaded is not
>> export.gzip, but instead is a copy of my rendered template and my
>> template is not rendered in my 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.
>>
>>
>
> --
> 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: save as

2013-03-20 Thread Felipe Prenholato
When page loads (document.ready), do a ajax call to a view that returns PDF
file.

Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://devwithpassion.com | http://chronosbox.org/blog
GitHub: http://github.com/chronossc/ | Twitter: http://twitter.com/chronossc


2013/3/20 Larry Martell 

> On Wed, Mar 20, 2013 at 5:34 AM, Tom Evans 
> wrote:
> > On Wed, Mar 20, 2013 at 11:28 AM, Larry Martell 
> wrote:
> >> Yes, I have convinced them to not require this. Now my issue is how to
> >> cause a file to be saved and to also render a template. When I return
> >> this:
> >>
> >> response = HttpResponse('This is what I want to save')
> >> response['Content-Type'] = 'application/gzip'
> >> response['Content-disposition'] = 'Attachment;
> filename=export.gzip'
> >> return response
> >>
> >> my template is obviously not rendered. How can I do this and also
> >> render my template at the same time?
> >>
> >
> > Use render() shortcut to generate a response and set the appropriate
> > attributes on it before returning the response. Eg:
> >
> >   response = render(request, 'my_template.html', { })
> >   response['Content-Type'] = 'application/gzip'
> >   response['Content-disposition'] = 'Attachment; filename=export.gzip'
> >   return response
>
> This is downloading a file, but the file that gets downloaded is not
> export.gzip, but instead is a copy of my rendered template and my
> template is not rendered in my 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.
>
>
>

-- 
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: PostgresSQL or MySql with django?

2013-03-20 Thread Felipe Prenholato
I'll bookmark this answer and show to anyone who ask about mysql \m/

Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://devwithpassion.com | http://chronosbox.org/blog
GitHub: http://github.com/chronossc/ | Twitter: http://twitter.com/chronossc


2013/3/18 Russell Keith-Magee 

>
> On Tue, Mar 19, 2013 at 12:07 AM, Philip Goh wrote:
>
>> They're much of a muchness. I've favoured Postgres because it seems more
>> straightforward as there aren't multiple distributions and crucially
>> multiple storage engines to worry about. In MySQL's favour, Amazon RDS
>> makes it incredibly simple to set up a scalable and reliable database so
>> bear that in mind if you're targeting Amazon's EC2 infrastructure.
>>
>> In the end, if you're asking this question you can't go far wrong if you
>> toss a coin and pick one.
>>
>>
> Much of a muchness? They *really* aren't. One of them is an actual
> database. One of them… isn't.
>
> I've used both MySQL and PostgreSQL in production sites, and I've been a
> developer on Django's ORM for over 7 years. In all that time, my experience
> of MySQL has been a constant stream of "What the hell were they smoking".
> In all that time, I can't think of a single thing PostgreSQL has done which
> was equally surprising. PostgreSQL just does what a database should do.
>
> PostgreSQL is a fast, well engineered database that follows the SQL
> specification well. It has a rich indexing structure, and a query planner
> that makes generally smart decisions.
>
>  MySQL doesn't implement transactions at all under MyISAM, and gets them
> *wrong* under InnoDB (constraint deferral anyone?). It has an incredibly
> naive indexing structure, and a query planner that is dumb as a bag of
> hammers. If it's even *possible* for the MySQL query planner to use an
> index, it will almost universally select the *wrong* index. And I hope you
> weren't planning to do anything exotic like a subquery.
>
> And then, just for giggles, MySQL does stuff like this:
>
> https://code.djangoproject.com/ticket/16809
>
> Summary - if you issue a SELECT query that contains an "WHERE X IS NONE"
> clause, and nothing matches the SELECT, and an object was inserted by the
> last statement, the SELECT query returns *the primary key of the object
> that was recently inserted*, not an empty result set. Anyone who can
> rationalize this behavior without resorting to medicinal grade
> hallucinogens wins a shiny new penny.
>
> Once upon a time, you *might* have been able to argue that MySQL was
> easier to install, was faster for certain usage profiles, and had better
> support for master/slave setups. But that was 5-10 years ago.
>
> At this point in time, the *only* advantage that MySQL has is it's
> ubiquity, especially when it comes to deployment platforms -- MySQL's
> historical popularity means that some cloud hosting providers (like Amazon)
> provide MySQL support before they provide PostgreSQL support. However, you
> can get cloud hosted PostgreSQL (e.g., Heroku), and it's not *that* hard to
> set up yourself if that's compatible with your needs.
>
> tl;dr - Friends don't let friends use MySQL.
>
> 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: TDD with Django/Splinter/plupload queue

2013-03-20 Thread Elliot Bradbury
PhantomJS is a headless webkit browser that can be programmed to perform
automated webpage tasks (like maybe select a file for upload). The standard
API is Javscript but I believe there is a Python port. Maybe that could
help?

http://phantomjs.org/

On Wed, Mar 20, 2013 at 3:34 PM, Bill Freeman  wrote:

> You can always write a stand alone python tool that pretends that it is a
> browser, does the GET, confirms that the form looks right, gathers the
> cookies or other CSRF token souces, and does the POST, including attaching
> the uploaded data parts.  But since this requires dipping into HTTP and
> HTML further than most people go, it has the potential to be more
> complicated than what you are testing.  Perhaps someone has already done
> this and will comment.
>
> Of course this doesn't test any browser JavaScript that you are using.
>
> Another approach, probably even more complex, is to add to your favorite
> browser(s) the ability to script the filling of upload fields.
>
> There are engines that allow you to script clicking and typing on a
> desktop, but I have no experience with them, and that sounds fragile to me,
> since, for example, FireFox auto updates and where things are changes.
>
> Bill
>
>
> On Wed, Mar 20, 2013 at 2:19 PM, Daniel França wrote:
>
>> Hi all,
>> I'm trying to set up tests for a upload using the plupload queue widget:
>> http://www.plupload.com/
>> I'm using Splinter for in-browser test, but I couldn't find a way to make
>> it happen. Splinter has some methods to attach files, but only if it's a
>> simple file field.
>> Another way would be click the button to browse the files, and choose the
>> file... but I don't think it's possible using Splinter (or selenium), is it?
>> Or with drag-n-drop of the files.
>>
>> Anyone has any suggestion of the best way to automatize theses tests?
>>
>> --
>> Daniel França,
>> about.me/danielfranca
>>
>> --
>> 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.
>
>
>

-- 
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: TDD with Django/Splinter/plupload queue

2013-03-20 Thread Bill Freeman
You can always write a stand alone python tool that pretends that it is a
browser, does the GET, confirms that the form looks right, gathers the
cookies or other CSRF token souces, and does the POST, including attaching
the uploaded data parts.  But since this requires dipping into HTTP and
HTML further than most people go, it has the potential to be more
complicated than what you are testing.  Perhaps someone has already done
this and will comment.

Of course this doesn't test any browser JavaScript that you are using.

Another approach, probably even more complex, is to add to your favorite
browser(s) the ability to script the filling of upload fields.

There are engines that allow you to script clicking and typing on a
desktop, but I have no experience with them, and that sounds fragile to me,
since, for example, FireFox auto updates and where things are changes.

Bill

On Wed, Mar 20, 2013 at 2:19 PM, Daniel França wrote:

> Hi all,
> I'm trying to set up tests for a upload using the plupload queue widget:
> http://www.plupload.com/
> I'm using Splinter for in-browser test, but I couldn't find a way to make
> it happen. Splinter has some methods to attach files, but only if it's a
> simple file field.
> Another way would be click the button to browse the files, and choose the
> file... but I don't think it's possible using Splinter (or selenium), is it?
> Or with drag-n-drop of the files.
>
> Anyone has any suggestion of the best way to automatize theses tests?
>
> --
> Daniel França,
> about.me/danielfranca
>
> --
> 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: save as

2013-03-20 Thread Larry Martell
On Wed, Mar 20, 2013 at 5:34 AM, Tom Evans  wrote:
> On Wed, Mar 20, 2013 at 11:28 AM, Larry Martell  
> wrote:
>> Yes, I have convinced them to not require this. Now my issue is how to
>> cause a file to be saved and to also render a template. When I return
>> this:
>>
>> response = HttpResponse('This is what I want to save')
>> response['Content-Type'] = 'application/gzip'
>> response['Content-disposition'] = 'Attachment; filename=export.gzip'
>> return response
>>
>> my template is obviously not rendered. How can I do this and also
>> render my template at the same time?
>>
>
> Use render() shortcut to generate a response and set the appropriate
> attributes on it before returning the response. Eg:
>
>   response = render(request, 'my_template.html', { })
>   response['Content-Type'] = 'application/gzip'
>   response['Content-disposition'] = 'Attachment; filename=export.gzip'
>   return response

This is downloading a file, but the file that gets downloaded is not
export.gzip, but instead is a copy of my rendered template and my
template is not rendered in my 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.




Appomatic: A django app packaging system based on pip

2013-03-20 Thread egil . moeller


Hi!

I'd like to introduce a new mini-framework for Django: Appomatic.

Appomatic automates and abstracts away most of the boilerplate code and 
code generation of a typical Django project, reduces the amount of 
settings.py clutter and allows for distributing self contained single-click 
installable Django apps.

In short - it makes installing django apps as simple as installing Drupal 
or Wordpress modules.
https://github.com/redhog/appomatic

It is based on virtualenv and pip.

Best regards,
Egil Möller

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




Apache JQuery deployment advice

2013-03-20 Thread Sells, Fred
I'm converting a Java jnlp app with a tomcat backend to an HTML5/jQuery/AJAX UI 
with a Django/Apache backend.

This is an intranet application with <50 users and a very light workload.  Idle 
90% of the time and ~5 users active at a time.  There are only 2 or 3 pages in 
the entire project.  I don't think I need templates at all but can handle it 
with one static HTML page and AJAX, using jQuery's .load() function to assemble 
the "components" combined with a tabnavigator to change views.

While this application is not very "busy" it is very complex and the 
requirements change frequently.

My concern is coming up with a deploy strategy that makes it easy to manage 
upgrades and the occasional revert when an upgrade is buggy.  And yes I know it 
should be tested better, but there are internal issues that prevent that.

All my prior apps have used Adobe's Flex/Flash for client,  XML for data 
transfer and Apache/Django 1.3/MySQL for the server.  In those applications I 
would use a "daisy chain" of symlinks to point to the current deploy like this

Maindeploydir
/v001
   /v002
   ...
   /v099
   /current -> v099

Under htdocs and under my wsgi directory I would have symlinks that point to 
/home/maindeploydir/current/gui  and /home/maindeploydir/current/mydjangosite 
respectively

Thus a new deployment just involves changes the "current" symlink.

This seemed reasonable when the client was build using the Flex IDE and the 
server was built using Eclipse/PyDev.  But now that I'm abandoning Flex, I 
think there should be a better way.  Perhaps my lack of experience with 
staticfiles is a factor in not seeing the light, but I would appreciate some 
insight into a sound deployment strategy.

Thanks,

Fred.


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




TDD with Django/Splinter/plupload queue

2013-03-20 Thread Daniel França
Hi all,
I'm trying to set up tests for a upload using the plupload queue widget:
http://www.plupload.com/
I'm using Splinter for in-browser test, but I couldn't find a way to make
it happen. Splinter has some methods to attach files, but only if it's a
simple file field.
Another way would be click the button to browse the files, and choose the
file... but I don't think it's possible using Splinter (or selenium), is it?
Or with drag-n-drop of the files.

Anyone has any suggestion of the best way to automatize theses tests?

-- 
Daniel França,
about.me/danielfranca

-- 
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: Goodbye, Malcolm

2013-03-20 Thread Jian Chang
Rest in peace

2013/3/21 Ernest Mundia 

> M.H.S.R.I.P
>
>
> On Wed, Mar 20, 2013 at 6:16 PM, Javi Romero wrote:
>
>> El martes, 19 de marzo de 2013 18:01:39 UTC+1, Jacob Kaplan-Moss escribió:
>>
>> Hello fellow Djangonauts,
>>>
>>> We have difficult news: Malcolm Tredinnick has passed away.
>>>
>>> Malcolm was a long-time contributor to Django, a model community member,
>>> a brilliant mind, and a friend. His contributions to Django — and to
>>> many other open source projects — are nearly impossible to enumerate.
>>> Many on the core Django team had their first patches reviewed by him;
>>> his mentorship enriched us. His consideration, patience, and dedication
>>> will always be an inspiration to us.
>>>
>>> To say we'll miss him is an understatement.
>>>
>>> Our thoughts are with Malcolm's friends, colleagues, and family at this
>>> difficult time.
>>>
>>> This came as quite a shock, and we're still sorting out details. We'll
>>> update our blog,
>>> https://www.djangoproject.com/**weblog/2013/mar/19/goodbye-**malcolm/,
>>>
>>> once we know the details of how you can express your condolences to
>>> Malcolm's friends and family.
>>>
>>> — The Django Core Team
>>>
>>
>> R.I.P. Thanks for all you've done for the community.
>>
>> --
>> 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.
>>
>>
>>
>
>
>
> --
> Ernest Mundia
> "Keep lookingDon't settle"
>
>
>  --
> 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: Goodbye, Malcolm

2013-03-20 Thread Ernest Mundia
M.H.S.R.I.P

On Wed, Mar 20, 2013 at 6:16 PM, Javi Romero  wrote:

> El martes, 19 de marzo de 2013 18:01:39 UTC+1, Jacob Kaplan-Moss escribió:
>
> Hello fellow Djangonauts,
>>
>> We have difficult news: Malcolm Tredinnick has passed away.
>>
>> Malcolm was a long-time contributor to Django, a model community member,
>> a brilliant mind, and a friend. His contributions to Django — and to
>> many other open source projects — are nearly impossible to enumerate.
>> Many on the core Django team had their first patches reviewed by him;
>> his mentorship enriched us. His consideration, patience, and dedication
>> will always be an inspiration to us.
>>
>> To say we'll miss him is an understatement.
>>
>> Our thoughts are with Malcolm's friends, colleagues, and family at this
>> difficult time.
>>
>> This came as quite a shock, and we're still sorting out details. We'll
>> update our blog,
>> https://www.djangoproject.com/**weblog/2013/mar/19/goodbye-**malcolm/,
>>
>> once we know the details of how you can express your condolences to
>> Malcolm's friends and family.
>>
>> — The Django Core Team
>>
>
> R.I.P. Thanks for all you've done for the community.
>
> --
> 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.
>
>
>



-- 
Ernest Mundia
"Keep lookingDon't settle"

-- 
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: Goodbye, Malcolm

2013-03-20 Thread Javi Romero
El martes, 19 de marzo de 2013 18:01:39 UTC+1, Jacob Kaplan-Moss escribió:

> Hello fellow Djangonauts, 
>
> We have difficult news: Malcolm Tredinnick has passed away. 
>
> Malcolm was a long-time contributor to Django, a model community member, 
> a brilliant mind, and a friend. His contributions to Django — and to 
> many other open source projects — are nearly impossible to enumerate. 
> Many on the core Django team had their first patches reviewed by him; 
> his mentorship enriched us. His consideration, patience, and dedication 
> will always be an inspiration to us. 
>
> To say we'll miss him is an understatement. 
>
> Our thoughts are with Malcolm's friends, colleagues, and family at this 
> difficult time. 
>
> This came as quite a shock, and we're still sorting out details. We'll 
> update our blog, 
> https://www.djangoproject.com/weblog/2013/mar/19/goodbye-malcolm/, 
> once we know the details of how you can express your condolences to 
> Malcolm's friends and family. 
>
> — The Django Core Team 
>

R.I.P. Thanks for all you've done for the community. 

-- 
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: PostgresSQL or MySql with django?

2013-03-20 Thread Patrick Craston
Alternatively, I've found this tool works very well:

https://pypi.python.org/pypi/py-mysql2pgsql

(only thing to look out for are Django IPAddressFields as they are char(15) 
fields in MySQL and inet fields in Postgres - py-mysql2pgsql is obviously not 
aware of this)

HTH

Patrick

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Tom Evans
Sent: 20 March 2013 14:12
To: django-users@googlegroups.com
Subject: Re: PostgresSQL or MySql with django?

On Wed, Mar 20, 2013 at 1:54 PM, frocco  wrote:
> Hello,
>
> I know this is not django related, but can someone help me with the 
> syntax to port mysql to postgresql?
> I tried the mysqldump command with the postgresql compatibility 
> option, but I still cannot import the data.
>
> Thanks
>
>

Django itself has mechanisms for importing and exporting data in a database 
independent format:

https://docs.djangoproject.com/en/1.5/ref/django-admin/#django-admin-dumpdata

If you are not dealing with huge amounts of data, this can be the simplest way 
forward.

Cheers

Tom

--
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: PostgresSQL or MySql with django?

2013-03-20 Thread Tom Evans
On Wed, Mar 20, 2013 at 1:54 PM, frocco  wrote:
> Hello,
>
> I know this is not django related, but can someone help me with the syntax
> to port mysql to postgresql?
> I tried the mysqldump command with the postgresql compatibility option, but
> I still cannot import the data.
>
> Thanks
>
>

Django itself has mechanisms for importing and exporting data in a
database independent format:

https://docs.djangoproject.com/en/1.5/ref/django-admin/#django-admin-dumpdata

If you are not dealing with huge amounts of data, this can be the
simplest way forward.

Cheers

Tom

-- 
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: PostgresSQL or MySql with django?

2013-03-20 Thread frocco
Hello,

I know this is not django related, but can someone help me with the syntax 
to port mysql to postgresql?
I tried the mysqldump command with the postgresql compatibility option, but 
I still cannot import the data.

Thanks


On Monday, March 18, 2013 11:30:35 AM UTC-4, frocco wrote:
>
> Hello,
>
> What is the recommended database for django?
>
> I have used MySQL, but am interested in Postgres.
>
> 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: stupid order by question

2013-03-20 Thread Larry Martell
On Wed, Mar 20, 2013 at 6:56 AM, Branko Majic  wrote:
> On Wed, 20 Mar 2013 06:48:26 -0600
> Larry Martell  wrote:
>
>> karlfs = Klarf.objects.filter(dr4i_id=dr4i.id).order_by(defect__name)
>>
>> But I'm getting NameError: "global name 'defect__name' is not defined"
>
> You forgot to quote defect__name. I.e.
>
> karlfs = Klarf.objects.filter(dr4i_id=dr4i.id).order_by('defect__name')

ARRRGH! Thank you so much!

-- 
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: stupid order by question

2013-03-20 Thread Branko Majic
On Wed, 20 Mar 2013 06:48:26 -0600
Larry Martell  wrote:

> karlfs = Klarf.objects.filter(dr4i_id=dr4i.id).order_by(defect__name)
> 
> But I'm getting NameError: "global name 'defect__name' is not defined"

You forgot to quote defect__name. I.e.

karlfs = Klarf.objects.filter(dr4i_id=dr4i.id).order_by('defect__name')

Best regards

-- 
Branko Majic
Jabber: bra...@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.


signature.asc
Description: PGP signature


stupid order by question

2013-03-20 Thread Larry Martell
I have these tables:

class Defect(models.Model):
name = models.CharField(max_length=100)

class Klarf(models.Model):
dr4i = models.ForeignKey(DR4i, db_index=True)
defect = models.ForeignKey(Defect)
xrel = models.FloatField(null=True)
yrel = models.FloatField(null=True)

I have a dr4i_id and I want to select the Klarf rows for that, in
order by the defect name. I am doing this:

karlfs = Klarf.objects.filter(dr4i_id=dr4i.id).order_by(defect__name)

But I'm getting NameError: "global name 'defect__name' is not defined"

I've tried this 20 different ways, but none work. I'm sure this is
just case of not enough coffee.

-- 
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: Trouble in getting django session on app engine

2013-03-20 Thread Tom Evans
On Wed, Mar 20, 2013 at 10:19 AM, Suja C Varghese  wrote:
> I have read this and tried using django sessions. And i got error -
> ImproperlyConfigured: settings.DATABASES is improperly configured. Please
> supply the ENGINE value. Check settings documentation for more details.
>

You need to specify your database backend.

If you specify that sessions are stored in the database, then you must
specify the database in your settings.

Please note that Django on app engine is not officially supported.
There are two ways of using it, using a branch/fork of django called
django-nonrel, or by using Google's Cloud SQL driver.

django-nonrel is a fork of Django 1.3 with support for appengine. It
has significant differences to django.

https://github.com/django-nonrel/django/tree/nonrel-1.3

CloudSQL I think you have to pay for:

https://developers.google.com/appengine/docs/python/cloud-sql/django

You will have to use one of these two solutions if you want to run
django on appengine.

Cheers

Tom

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




Trouble in getting django session on app engine

2013-03-20 Thread Suja C Varghese
I have read 
thisand
 tried using django sessions. And i got error - ImproperlyConfigured: 
settings.DATABASES is improperly configured. Please supply the ENGINE 
value. Check settings documentation for more details.

ERROR2013-03-20 09:51:09,865 base.py:215] Internal Server Error: 
/common/show/captcha/contactInquiry
Traceback (most recent call last):
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/core/handlers/base.py",
 
line 188, in get_response
response = middleware_method(request, response)
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/contrib/sessions/middleware.py",
 
line 36, in process_response
request.session.save()
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/contrib/sessions/backends/db.py",
 
line 51, in save
session_key=self._get_or_create_session_key(),
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/contrib/sessions/backends/base.py",
 
line 145, in _get_or_create_session_key
self._session_key = self._get_new_session_key()
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/contrib/sessions/backends/base.py",
 
line 139, in _get_new_session_key
if not self.exists(session_key):
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/contrib/sessions/backends/db.py",
 
line 27, in exists
return Session.objects.filter(session_key=session_key).exists()
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/db/models/query.py",
 
line 565, in exists
return self.query.has_results(using=self.db)
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/db/models/sql/query.py",
 
line 441, in has_results
return bool(compiler.execute_sql(SINGLE))
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/db/models/sql/compiler.py",
 
line 808, in execute_sql
sql, params = self.as_sql()
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/db/models/sql/compiler.py",
 
line 71, in as_sql
out_cols = self.get_columns(with_col_aliases)
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/db/models/sql/compiler.py",
 
line 180, in get_columns
result = ['(%s) AS %s' % (col[0], qn2(alias)) for alias, col in 
self.query.extra_select.iteritems()]
  File 
"/home/suja/Dev/resources/google_appengine/lib/django-1.4/django/db/backends/dummy/base.py",
 
line 15, in complain
raise ImproperlyConfigured("settings.DATABASES is improperly 
configured. "


I am using dev_appserver.datastore. Pls do 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.




Pickling of dinamically created models.Model subclasses: "attribute lookup failed", django 1.5

2013-03-20 Thread Sir Anthony
Hello,
I'm using django-audit-log 
witch actively creates dynamic 
models by calling type('%sAuditLogEntry' 
% meta_name, (models.Model,), 
attrs).
 
In django 1.5 I getting error when trying to cache it (pickling phase). 
Example error string: Can't pickle : attribute lookup 
testproject.models.TestItemAuditLogEntry failed. I think it because pickle 
tries to use class name with current environment.
I looked in django sources and found that this 
commitis
 cause of such behaviour. 
I'm not sure it is django bug (I'll write a ticket with test case and 
probably patch, instead), maybe I just need to made some hacks on my side, 
like implement intermediate model with custom __reduce__ like in 1.4 django 
or something alike.


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

2013-03-20 Thread Tom Evans
On Wed, Mar 20, 2013 at 11:28 AM, Larry Martell  wrote:
> Yes, I have convinced them to not require this. Now my issue is how to
> cause a file to be saved and to also render a template. When I return
> this:
>
> response = HttpResponse('This is what I want to save')
> response['Content-Type'] = 'application/gzip'
> response['Content-disposition'] = 'Attachment; filename=export.gzip'
> return response
>
> my template is obviously not rendered. How can I do this and also
> render my template at the same time?
>

Use render() shortcut to generate a response and set the appropriate
attributes on it before returning the response. Eg:

  response = render(request, 'my_template.html', { })
  response['Content-Type'] = 'application/gzip'
  response['Content-disposition'] = 'Attachment; filename=export.gzip'
  return response

Cheers

Tom

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

2013-03-20 Thread Larry Martell
On Wed, Mar 20, 2013 at 2:50 AM, Branko Majic  wrote:
> On Tue, 19 Mar 2013 19:27:33 -0600
> Larry Martell  wrote:
>
>> On Tue, Mar 19, 2013 at 7:07 PM, Tim Chase
>>  wrote:
>> > On 2013-03-19 18:42, Larry Martell wrote:
>> >> https://docs.djangoproject.com/en/dev/howto/outputting-pdf/ which
>> >> says to use the Content-disposition header to trigger the save as.
>> >> I've done this, but I don't get a save as dialog box. The file is
>> >> just downloaded to a download dir with the name I have provided.
>> >>
>> >> Is there a way I can specify from my app what directory I want the
>> >> file saved to?
>> >
>> > I believe this is a browser-configuration setting controlled by the
>> > user, not by HTTP metadata.  In Firefox, I have the option to either
>> > open the file or save the file, along with a check-box to "always do
>> > this"; FF also provides me the control to specify where the file
>> > goes on a per-download basis, or to default to a given location.
>> >
>> > tl;dr: I don't think your web-app can take away this control from
>> > the user.
>>
>> That's what I thought, but my client wants the file saved to a
>> specific location. This is an internal app, not something for public
>> usage. Perhaps I can pass the file back in a context and save it from
>> javscript.
>>
>
> I'd be very surprised if you could use JavaScript to do something like
> that. It would've been considered a security vulnerability by any
> browser software vendor out there.
>
> If client wants the file to be saved to specific location, you should
> probably try to direct them to some specific solution for the browser
> of their choice. For Firefox you should be able to find some extensions
> that can automatically save files to certain directories based on file
> type. Maybe there's something out there that could do so based on MIME
> type (Content-Disposition) set for the file (so you can set something
> other than PDF for it in order to have other website PDFs saved to
> other locations).
>
> If you are really persistent, you could try using some kind of Flash
> thing or Java applet, but that's a very, very, very, very bad idea.
>
> So, you'll probably left with negotiating it with your client not to
> insist on that, or see if you can tweak the browser settings in some
> way (most probably with an extension) :)

Yes, I have convinced them to not require this. Now my issue is how to
cause a file to be saved and to also render a template. When I return
this:

response = HttpResponse('This is what I want to save')
response['Content-Type'] = 'application/gzip'
response['Content-disposition'] = 'Attachment; filename=export.gzip'
return response

my template is obviously not rendered. How can I do this and also
render my template at the same time?

-- 
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't create an object with a foreign key

2013-03-20 Thread Tom Evans
On Tue, Mar 19, 2013 at 5:13 PM, Cody Scott  wrote:
> I get the error when I try to make an object.
>
>> Cannot assign "u'Category object'": "Course.category" must be a "Category"
>> instance.
>
>
> here is my admin form
>
> admin.py
>
> admin.site.register(Category, list_display = ('name',))
>
>
> CATEGORIES = [(category, category.name) for category in
> Category.objects.all()]

This will get calculated the first time the file is executed. This
means if you add any additional categories after that point, they
would not be reflected in this list.

>
> class CourseAdminForm(forms.ModelForm):
> class Meta:
> model = Course
> category = forms.ChoiceField(choices=CATEGORIES)

You cannot do that. If 'category' on the model is a foreign key to a
Category model, then the form field representing it must eventually
produce a Category instance. Choice fields always coerce their values
to return a string. This is the error warned about here (see the end
of the 'Note' section):

https://docs.djangoproject.com/en/1.5/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets

The real question is why you are doing this. It seems like you are
trying to replicate the behaviour of a ModelChoiceField, without using
a ModelChoiceField. Is this because you want to customize how the
choices appear? There is an easier way of doing so, you can customize
the field to display your instance however you wish:


class CategoryChoiceField(forms.ModelChoiceField):
def label_from_instance(self, instance):
return instance.name

class CourseAdminForm(forms.ModelForm):
class Meta:
model = Course
category = CategoryChoiceField()

https://docs.djangoproject.com/en/1.5/ref/forms/fields/#django.forms.ModelChoiceField

Cheers

Tom

-- 
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 throws ImproperlyConfigured error when loading URLconf on startup

2013-03-20 Thread Andrei
Hi again,

I have managed to run into the issue on a project not using Django CMS. It 
also runs gunicorn with gevent.

Andrei

On Thursday, November 29, 2012 12:03:10 AM UTC+1, Michael Dippery wrote:
>
> I have a Django app running on a production server. It is handled with 
> gunicorn 0.14.2 behind nginx. When I reload the app (by reloading the 
> gunicorn workers), I get this error: 
>
> --- 
> Traceback (most recent call last): 
>
>  File 
> "/opt/app/venv/myapp/lib/python2.6/site-packages/django/core/handlers/base.py",
>  
> line 101, in get_response 
>request.path_info) 
>
>  File 
> "/opt/app/venv/myapp/lib/python2.6/site-packages/django/core/urlresolvers.py",
>  
> line 250, in resolve 
>for pattern in self.url_patterns: 
>
>  File 
> "/opt/app/venv/myapp/lib/python2.6/site-packages/django/core/urlresolvers.py",
>  
> line 283, in _get_url_patterns 
>raise ImproperlyConfigured("The included urlconf %s doesn't have any 
> patterns in it" % self.urlconf_name) 
>
> ImproperlyConfigured: The included urlconf myapp.urls doesn't have any 
> patterns in it 
> --- 
>
> Others with this problem have commonly noted that it occurs while using 
> reverse in a URLconf, but I am not using reverse in any URLconfs (nor are 
> they used in any third-party apps). Also, this error only occurs in 
> production -- never in development (using the Django dev server) or on my 
> staging server (also using gunicorn 0.14.2 behind nginx). It also doesn't 
> seem to cause trouble with the site at any other time then during reloads. 
> And it only happens for the first 10-20 requests on the website (which 
> makes me wonder if it's some sort of race condition, perhaps). 
>
> Any ideas what's causing the problem?

-- 
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: Help with Django form wizard.

2013-03-20 Thread Dilip M
On Thu, Mar 7, 2013 at 9:21 PM, Dilip M  wrote:

> Hi,
>
> Here is what I am trying to do. Get the root folder name in form 1 and
> list the found sub directories (matching a pattern) and give an
> option for user to select the sub dirs. Once selected,  I want to save the
> model.
>
> 1. How to dynamically display found sub directories in form 2. I have
> defined a method (def _findSubs) in views.py
> 2. I have split a model into 2 forms. How to save the data fetched from 2
> forms into one model.
> 3. I have read the docs. But couldn't figure out where to put
> WizardView.get_form_initial() method. My knowledge with Django is very
> trivial.
>
> Here is what I am doing.
>
> 
> models.py
> ---
>
> from django.db import models
>
> class Tree(models.Model):
> rootDir = models.CharField(max_length=100) # will be populated using
> form 1
> subDirs = models.CharField(max_length=100) # will be populated using
> form 2
>
> def __unicode__(self):
> return u'%s %s' % (self.rootDir, self.subDir)
>
>
> 
> views.py
> ---
>
> from django.shortcuts import render
> from django.http import HttpResponseRedirect
> from django.contrib.formtools.wizard.views import SessionWizardView
> from myapp.forms import MainForm, SecondForm
>
>
> FORMS = [("main", MainForm), ("select", SecondForm)]
> TEMPLATES = {"main": "main.html", "select": "select.html"}
>
> class FormWizard(SessionWizardView):
>
> def get_template_names(self):
> return [TEMPLATES[self.steps.current]]
>
>

def get_form_kwargs(self, step):
if step == 'select':
kwargs = {}
kwargs.update({'choices': (('1', 'Option1'), ('2',
'Option2'))})

return kwargs
else:
return {}


Now I get

File "C:\Python27\lib\site-packages\django\contrib\formtools\wizard\views.py"
in render_next_step  302.
files=self.storage.get_step_files(next_step))File
"C:\Python27\lib\site-packages\django\contrib\formtools\wizard\views.py"
in get_form  395. return
self.form_list[step](**kwargs)Exception Type: TypeError at /Exception
Value: __init__() got an unexpected keyword argument 'choices'


---
forms.py
---

from django import forms
from myapp.models import Tree

.
.

class SecondForm(forms.Form):
SUBDIRS = # _findSubs result should be here.
SELECTED =
forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices =
SUBDIRS)




> def done(self, form_list, **kwargs):
> # Now save Model here. HOW??
> pass
>
>
> def main(request):
>
> if request.method == 'POST':
> http_req_type = request.method
> mainform = MainForm(request.POST)
>
> if mainform.is_valid():
> cd = mainform.cleaned_data
> tree = cd['rootDir']
>subdirs = _findSubs(tree)
> else:
> http_req_type = request.method
> mainform = MainForm()
>
> return render(request, 'main.html', locals())
>
> def selection(request):
> if request.method == 'POST':
> http_req_type = request.method
> selectionform = SecondForm(request.POST)
>
> if selectionform.is_valid():
> cd = selectionform.cleaned_data
> subdirs = selectionform.cleaned_data.get('SELECTED')
> return HttpResponseRedirect('/done/')
> else:
> http_req_type = request.method
> form = SecondForm()
>
> return render(request, 'select.html', {'form':form })
>
> def _findSubs(tree):
> ''' Return a list of sub directory matching the pre-defined patter
> '''
> # some logic here. Don't worry abt it.
> return subs
>
>
> ---
> urls.py
> ---
> from myapp import views
>
> url(r'^main/', views.FormWizard.as_view(views.FORMS)),
>
>

-- 
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: Authentication with Email

2013-03-20 Thread Frank Bieniek

Hi,
take a look at http://www.django-userena.org/
customziable login and registration.

Thanks
Frank


Am 20.03.2013 01:09, schrieb fire_water:

Hi,

I am fairly new to Django and have started building a website that 
will require users to create an account with a username, email 
address, and password. Users will log in with their email address and 
password, not username.


There has been a lot of discussion about this topic in the past, but I 
was wondering what the current best practice is for solving these 
problems:


1. User email address is required and unique

2. Must log in with email address and password

3. Add additional fields to models.user

4. Must not impact other built-in apps or third-party apps

One approach is to extend models.user by way of a one-to-one 
relationship, as described in the docs 
. 
But that does not solve #1 and #2.


Which approach do you recommend as a long-term solution?

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

2013-03-20 Thread Branko Majic
On Tue, 19 Mar 2013 19:27:33 -0600
Larry Martell  wrote:

> On Tue, Mar 19, 2013 at 7:07 PM, Tim Chase
>  wrote:
> > On 2013-03-19 18:42, Larry Martell wrote:
> >> https://docs.djangoproject.com/en/dev/howto/outputting-pdf/ which
> >> says to use the Content-disposition header to trigger the save as.
> >> I've done this, but I don't get a save as dialog box. The file is
> >> just downloaded to a download dir with the name I have provided.
> >>
> >> Is there a way I can specify from my app what directory I want the
> >> file saved to?
> >
> > I believe this is a browser-configuration setting controlled by the
> > user, not by HTTP metadata.  In Firefox, I have the option to either
> > open the file or save the file, along with a check-box to "always do
> > this"; FF also provides me the control to specify where the file
> > goes on a per-download basis, or to default to a given location.
> >
> > tl;dr: I don't think your web-app can take away this control from
> > the user.
> 
> That's what I thought, but my client wants the file saved to a
> specific location. This is an internal app, not something for public
> usage. Perhaps I can pass the file back in a context and save it from
> javscript.
> 

I'd be very surprised if you could use JavaScript to do something like
that. It would've been considered a security vulnerability by any
browser software vendor out there.

If client wants the file to be saved to specific location, you should
probably try to direct them to some specific solution for the browser
of their choice. For Firefox you should be able to find some extensions
that can automatically save files to certain directories based on file
type. Maybe there's something out there that could do so based on MIME
type (Content-Disposition) set for the file (so you can set something
other than PDF for it in order to have other website PDFs saved to
other locations).

If you are really persistent, you could try using some kind of Flash
thing or Java applet, but that's a very, very, very, very bad idea.

So, you'll probably left with negotiating it with your client not to
insist on that, or see if you can tweak the browser settings in some
way (most probably with an extension) :)

Best regards

-- 
Branko Majic
Jabber: bra...@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.


signature.asc
Description: PGP signature