Re: memory leak in django 1.5

2013-03-24 Thread Craig de Stigter
Just confirming that this fixed the memory leak problem for us. Thanks 
again :)

On Friday, March 22, 2013 3:07:02 PM UTC+13, Craig de Stigter wrote:
>
> Karen Tracey saves the day!
>
> Thanks so much, seems likely that's it :)
>
> Craig de Stigter
>
> On Friday, March 22, 2013 2:25:04 PM UTC+13, Karen Tracey wrote:
>>
>> On Thu, Mar 21, 2013 at 9:00 PM, Craig de Stigter wrote:
>>
>>> Hi everyone
>>>
>>> (cross-posted because this seems relevant to both django-users and 
>>> developers, and both might have experienced this problem)
>>>
>>> We've noticed a gradual increase in memory usage for our apache 
>>> processes since upgrading to django 1.5.
>>>
>>> Here is a graph  showing memory usage 
>>> before and after we upgraded to django 1.5 on our web server. (the upgrade 
>>> occurs at 12:30 on the graph).
>>>
>>> I'm hoping someone else has noticed a similar thing and is able to 
>>> provide some insight.
>>>
>>
>> https://code.djangoproject.com/ticket/19895#comment:6
>>
>> notes a memory leak due to a fix that went into 1.5. 
>>
>> The fix was reverted on the 1.5.x branch about two days ago, so one thing 
>> to try would be to run current 1.5.x branch level rather than released 1.5.
>>
>> Karen
>>
>

-- 
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: An alternate cry for help

2013-03-24 Thread Cal Leeming [Simplicity Media Ltd]
Hi Christos,

I cannot comment directly on Pinax as I have never used it before, however
I can give some general comments.

Asking how to make a social network is the same as asking how to make a
game, how to build a car, how to write a book etc.. it *completely* depends
on what your end goal is, and how deep down the rabbit hole you want to go.

If your end goal is to better your development skills in Python, then you
could start out with something like this;
http://learnpythonthehardway.org/

If this is not your end goal, then you will have certain limitation. For
example, I could use (CMS FRAMEWORK HERE) to make a very basic blog with
zero programming skill, but extending the functionality would require
either a pre-existing plugin, or time being spent on learning the framework
and language.. I could possibly throw together a very quick hack, or spend
X amount of time learning every little bit about what I'm doing.

An excellent place to start looking would be on github, there are plenty of
projects you could use for inspiration/examples to get you started.

Hope this helps

Cal

On Sat, Mar 23, 2013 at 7:28 AM, Christos Jonathan Hayward <
christos.jonathan.hayw...@gmail.com> wrote:

> I wrote earlier asking if someone could correct my ignorance to go from
> Pinax building blocks to a working site. Since then, I searched Safari, and
> found five references to Pinax, at
> http://my.safaribooksonline.com/search?q=Pinax . One is a tangent in a
> Django book I wrote; three are Python books I didn't write; and one is an
> iPhone JavaScript book that includes 'pinax' in a Greek-English lexicon's
> URL.
>
> I realized after posting the original post below that although I'm an avid
> learner my ignorance of Pinax may be a bit of a challenge to straighten
> out. So besides the possibility of educating me to really know how to put
> Pinax sites together, could someone preassemble a complete social site that
> just needs database setup, a syncdb, and a gunicorn invocation? It would be
> nice to have the earlier Pinax Social Project reimplemented using the new
> tools, as opposed to the pinax-social-project which is a set of building
> blocks to complete a social project. It seems the general approach is to
> turn over better and better building blocks to the user, but the
> already-working sensible default has its merits, and I'd appreciate those
> merits after a day of struggling with old Pinax, new Pinax, borrowed Pinax,
> blue Pinax, not getting any responses with good learning resources, and
> searching Safari and recognizing that O'Reilly's whole Safari does not
> contain as much information about Pinax as the email you are reading, not
> enough by half, and that kind of makes my ignorance a less changeable
> condition. If I'm ignorant about Django but have the Django documentation
> and the Django book, I can reduce my ignorance. Here I don't see how I can
> reduce my ignorance, and my thoughts turn to an evaluation that working
> Pinax is excellent, not-configured Pinax that you don't know how to improve
> is worth very little, and Liferat is mediocre but works, in its own special
> way.
>
> *After a day or so of losing at trying to make pinax-social-network 1.0
> have the merits of Pinax social-project 0.5 or .7, I'd like to ask how to
> cut with the grain instead of against it.*
>
> *The earlier version came as a fully functional site: you could override
> and customize if you want, but it came "batteries included", as a room with
> well-chosen pegs on the walls, pictures hanging on the hooks, and furniture
> as needed. You could replace as much of the room's initial contents as you
> wanted, but it came as a furnished room.*
>
> *Pinax-social-network 1.0 is not a furnished room. It has pegs, and the
> pegs are about as well-placed as you could ask for, but if you want
> pictures on those pegs, it's on you to put pictures on the pegs. And there
> is space you can put furniture in the room; the room is left empty so you
> can put whatever furniture you want in. And the room comes with elegantly
> placed lorem ipsum graffiti on the walls, to motivate you to paint or
> wallpaper the walls to meet your taste. It comes "batteries removed."*
>
> *So... what are the resources, and how does one go about, making a social
> network here? Do I just take it as a bit of Django putty? I expect I'd do a
> lot of reinventing the wheel if I just use Django knowledge. Is there a
> tutorial that shows how to make a live site out of one of Pinax's projects?
> *
>
> *I spent a bit of time reading about Liferat Liferay before remembering
> how painful it was even when I knew it well. The problem here may just be
> that I am ignorant about Pinax, and ignorance is a changeable condition.*
>
> *So let's say I know something about Python, something about Django and
> something about older, fully assembled versions of Pinax, but not how to
> take a starter Pinax project and make a finished site out of it. I'm
> ignorant on that 

Re: POSTing JSON to Tastypie from Android

2013-03-24 Thread Pratik Mandrekar
Thanks, I got it to work after much of trial and error.

Here is the gist - https://gist.github.com/ratpik/5232763

Thanks,

Pratik

On Sunday, March 24, 2013 8:46:09 PM UTC+5:30, ke1g wrote:
>
> There are a couple of standard ways, IIRC, to encode post parameters, but 
> neither of them is JSON in the body.  Of course you can do as you want, and 
> android apparently does, but other software is unlikely to recognize it.
>
> Again, from memory, the two methods are using url encoding, and multi-part 
> form data.  The latter is particularly useful for large binary blobs (like 
> uploading files), but it looks as though the first method would work for 
> you.  You'll have to dig down into the android API to see how to do it 
> there, but it probably involves a particular value in the content-type 
> header.
>
> Bill
>
> On Sat, Mar 23, 2013 at 9:52 AM, Pratik Mandrekar 
>  > wrote:
>
>> Thanks for the pdb tip Bill!
>>
>> I tried pdb at the point where the request enters Tastypie (based on 
>> http://stackoverflow.com/questions/13006901/tastypie-obj-create-method-not-being-called).
>>  
>> What I see is that the request.POST and request.raw_post_data are both 
>> empty. I posted from Android client to a posttestserver and I can see that 
>> all the headers I set and the request body are set.
>>
>> However it does say that there are no POST parameters. Here is the logged 
>> request - http://posttestserver.com/data/2013/03/23/06.42.591241431084. 
>> Any idea what that means? Note that I had to remove the authorization 
>> header to post to this server.
>>
>> Also I'm not sure now where else to start the trace from. Is there 
>> another place I can pdb trace my HTTP request when it enters the app? Is it 
>> possible some data gets stripped off the original request somewhere?
>>
>> Thanks.
>>
>> Pratik
>>
>>
>>
>>
>>
>>
>> On Saturday, March 23, 2013 5:50:28 PM UTC+5:30, ke1g wrote:
>>
>>> Still, if you have a break point where the request comes in to the view, 
>>> you can inspect the POST data to see how it differs from what you expect.  
>>> That might inform you as to what you might do differently in your 
>>> JavaScript, whether you need some additional or different encoding or 
>>> quoting of the data, whether you need to be more explicit about the 
>>> content-type header (you may have to look at the WSGI request object 
>>> itself), etc.  Or you may discover that you need to breakpoint at the WSGI 
>>> application script level to see what you need to see.
>>>
>>> Since nobody has jumped in with "I recognize that problem", inspecting 
>>> your data is probably a good use of your time.  pdb is not hard to use, as 
>>> long as you are using runserver (and you can almost always arrange to 
>>> explore a problem under runserver) because there has to be a console for 
>>> pdb to type on, and on which you can type commands.  The first breakpoint 
>>> is the only django specific trick.  Put
>>>
>>> import pdb; pdb.set_trace()
>>>
>>> where you want to stop.  You can use the b command to set additional 
>>> breakpoints later, but that can be confusing due to threading.  pdb is 
>>> documented in the library reference for your python version at 
>>> python.org.  Read up on the p, pp, u, d, c, n, s, r, !, and q, 
>>> commands, probably in that order, and you will find that you usually only 
>>> use the first 5 of them.  (There are more, for when you want to be a pdb 
>>> expert.)  And remember to start with a p or pp when you want to see the 
>>> value of an expression, lest your expression be interpreted as one of the 
>>> other commands.
>>>
>>> Bill
>>>
>>> On Sat, Mar 23, 2013 at 5:19 AM, Pratik Mandrekar 
>>> wrote:
>>>
 The issue is with setting data in the http post request. I have tried 
 it with curl and the web client and it works. CSRF is not the issue, 
 requests work fine without the csrftoken outside of the android client.

 Pratik



 On Saturday, March 23, 2013 12:01:21 AM UTC+5:30, ke1g wrote:

> Have you tried a breakpoint in the view?  Might it be a CSRF problem?
>
> On Fri, Mar 22, 2013 at 2:22 PM, Pratik Mandrekar <
> pratikm...@gmail.com> wrote:
>
>> Hello,
>>
>> I'm unable to get the POST json to tastypie from an android http 
>> client to work.
>>  
>> *I have tried with HttpURLConnection*
>>
>> urlConnection = (HttpURLConnection) url.openConnection();
>>
>>
>> urlConnection.setDoInput(true)**;
>>
>>  urlConnection.setDoOutput(**true);
>>
>>  urlConnection.**setRequestProperty("Content-**Type", 
>> "application/json");
>>
>> byte [] encoded = 
>> Base64.encode((username+":"+**password).getBytes("UTF-8"), 
>> Base64.DEFAULT); 
>>
>>  urlConnection.**setRequestProperty("**Authorization", "Basic "+ 
>> new String(encoded, "UTF-8"));
>>
>>
>> JSONObject jsonObject = 

RE: first steps with django

2013-03-24 Thread Babatunde Akinyanmi
I love this post

Sent from my Windows Phone
--
From: Jeffrey Black
Sent: 3/24/2013 4:22 PM
To: django-users@googlegroups.com
Cc: django-users@googlegroups.com
Subject: Re: first steps with django

Give this a look first.

http://www.jeffknupp.com/blog/2012/10/24/starting-a-django-14-project-the-right-way/

jb

On Mar 24, 2013, at 5:23 AM, My Wasteland  wrote:

Hi list,

I am a Django newbie. I have been going through the official tutorial on my
local machine. I have got some general questions:

1. Where should I develop my Django applications? Should I still do it on
my local machine and then transfer them somehow to a hosting provider I'm
with? Or should I develop it straight on a hosting provider's server
(hosting provider provides a one-click django installation).

2. If the development should be on the hosting provider's account (ssh
access), then could you clarify the following? Imagine want the home page
to be static (eg. www.example.com) then I want my django app - blog on
www.example.com/blog, then I'd start a new django app in public_html/blog
right?

If I'm confusing things, please correct me.

Thank you
Martin

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




Django management call_command

2013-03-24 Thread Felix Wagner
Hello, I wrote a test management Command:

def start_daemon():
pidfile_rule = "/tmp/ihe_test.pid"
p = str(os.getpid())
file(pidfile_rule, 'w').write(p)
while True:
print "Hello"
sleep(10)

class Command(BaseCommand):
help = 'Starts or stops the daemons'

option_list = BaseCommand.option_list + (
make_option('--start',
action='store_true',
dest='status',
help='Start the daemons'),
make_option('--stop',
action='store_false',
dest='status',
default=False,
help='Stop the daemons'),
)

def handle(self, *args, **options):
status = options.get('status')
pidfile_rule = "/tmp/ihe_test.pid"
if status:
try:
start_daemon()
except Exception, e:
print e
else:
x = file(pidfile_rule, 'r').read()
os.kill(int(x), signal.SIGKILL)

Now what I want to accomplish:

In a form if a boolean field is True then execute (start) the daemon. If 
the boolean field is toggled False the daemon should be stopped. However 
the problem is:

wagnerf+  5882  0.3  0.1 108892 21388 pts/3S+   17:32   0:00 
/usr/bin/python2.7 manage.py runserver
wagnerf+  5883 51.5  0.4 580376 52292 pts/3Rl+  17:32   0:35 
/usr/bin/python2.7 manage.py runserve

One is the normal runserver and one is the daemon. Obviously I can't use 
the site anymore. How exactly must it be coded so that the managment call 
is a seperate process?

-- 
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: first steps with django

2013-03-24 Thread John
On 24/03/13 15:26, Shawn Milochik wrote:
> On Sun, Mar 24, 2013 at 11:21 AM, Jeffrey Black  
> wrote:
>> Give this a look first.
>>
>> http://www.jeffknupp.com/blog/2012/10/24/starting-a-django-14-project-the-right-way/
>>
>> jb
> That's a good post. I give a hearty +1 to virtualenv, South, Fabric, and git.
>
Thank you. I will follow it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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: first steps with django

2013-03-24 Thread Shawn Milochik
On Sun, Mar 24, 2013 at 11:21 AM, Jeffrey Black  wrote:
> Give this a look first.
>
> http://www.jeffknupp.com/blog/2012/10/24/starting-a-django-14-project-the-right-way/
>
> jb

That's a good post. I give a hearty +1 to virtualenv, South, Fabric, and git.

-- 
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: first steps with django

2013-03-24 Thread Jeffrey Black
Give this a look first.

http://www.jeffknupp.com/blog/2012/10/24/starting-a-django-14-project-the-right-way/

jb

On Mar 24, 2013, at 5:23 AM, My Wasteland  wrote:

> Hi list,
> 
> I am a Django newbie. I have been going through the official tutorial on my 
> local machine. I have got some general questions:
> 
> 1. Where should I develop my Django applications? Should I still do it on my 
> local machine and then transfer them somehow to a hosting provider I'm with? 
> Or should I develop it straight on a hosting provider's server (hosting 
> provider provides a one-click django installation). 
> 
> 2. If the development should be on the hosting provider's account (ssh 
> access), then could you clarify the following? Imagine want the home page to 
> be static (eg. www.example.com) then I want my django app - blog on 
> www.example.com/blog, then I'd start a new django app in public_html/blog 
> right?
> 
> If I'm confusing things, please correct me.
> 
> Thank you
> Martin
> -- 
> 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: first steps with django

2013-03-24 Thread Shawn Milochik
You should develop locally, because you are guaranteed to make
mistakes that will crash the app and expose debug information you
don't want exposed  during development.

If your hosting provider provides a one-click installation, it will
probably set up its environment different than the one on your local
machine, making deployment more difficult. If you're using Webfaction,
for example, I suggest you make a "custom" app that just opens a port,
then when you deploy just serve your Django app via gunicorn on that
port.

-- 
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-24 Thread Dan Gentry
Andrei, I once received this error when the problem was actually in another 
python module being imported - in my case views.py.  Hope this helps, Dan

-- 
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: POSTing JSON to Tastypie from Android

2013-03-24 Thread Bill Freeman
There are a couple of standard ways, IIRC, to encode post parameters, but
neither of them is JSON in the body.  Of course you can do as you want, and
android apparently does, but other software is unlikely to recognize it.

Again, from memory, the two methods are using url encoding, and multi-part
form data.  The latter is particularly useful for large binary blobs (like
uploading files), but it looks as though the first method would work for
you.  You'll have to dig down into the android API to see how to do it
there, but it probably involves a particular value in the content-type
header.

Bill

On Sat, Mar 23, 2013 at 9:52 AM, Pratik Mandrekar  wrote:

> Thanks for the pdb tip Bill!
>
> I tried pdb at the point where the request enters Tastypie (based on
> http://stackoverflow.com/questions/13006901/tastypie-obj-create-method-not-being-called).
> What I see is that the request.POST and request.raw_post_data are both
> empty. I posted from Android client to a posttestserver and I can see that
> all the headers I set and the request body are set.
>
> However it does say that there are no POST parameters. Here is the logged
> request - http://posttestserver.com/data/2013/03/23/06.42.591241431084.
> Any idea what that means? Note that I had to remove the authorization
> header to post to this server.
>
> Also I'm not sure now where else to start the trace from. Is there another
> place I can pdb trace my HTTP request when it enters the app? Is it
> possible some data gets stripped off the original request somewhere?
>
> Thanks.
>
> Pratik
>
>
>
>
>
>
> On Saturday, March 23, 2013 5:50:28 PM UTC+5:30, ke1g wrote:
>
>> Still, if you have a break point where the request comes in to the view,
>> you can inspect the POST data to see how it differs from what you expect.
>> That might inform you as to what you might do differently in your
>> JavaScript, whether you need some additional or different encoding or
>> quoting of the data, whether you need to be more explicit about the
>> content-type header (you may have to look at the WSGI request object
>> itself), etc.  Or you may discover that you need to breakpoint at the WSGI
>> application script level to see what you need to see.
>>
>> Since nobody has jumped in with "I recognize that problem", inspecting
>> your data is probably a good use of your time.  pdb is not hard to use, as
>> long as you are using runserver (and you can almost always arrange to
>> explore a problem under runserver) because there has to be a console for
>> pdb to type on, and on which you can type commands.  The first breakpoint
>> is the only django specific trick.  Put
>>
>> import pdb; pdb.set_trace()
>>
>> where you want to stop.  You can use the b command to set additional
>> breakpoints later, but that can be confusing due to threading.  pdb is
>> documented in the library reference for your python version at python.org.
>> Read up on the p, pp, u, d, c, n, s, r, !, and q, commands, probably in
>> that order, and you will find that you usually only use the first 5 of
>> them.  (There are more, for when you want to be a pdb expert.)  And
>> remember to start with a p or pp when you want to see the value of an
>> expression, lest your expression be interpreted as one of the other
>> commands.
>>
>> Bill
>>
>> On Sat, Mar 23, 2013 at 5:19 AM, Pratik Mandrekar 
>> wrote:
>>
>>> The issue is with setting data in the http post request. I have tried it
>>> with curl and the web client and it works. CSRF is not the issue, requests
>>> work fine without the csrftoken outside of the android client.
>>>
>>> Pratik
>>>
>>>
>>>
>>> On Saturday, March 23, 2013 12:01:21 AM UTC+5:30, ke1g wrote:
>>>
 Have you tried a breakpoint in the view?  Might it be a CSRF problem?

 On Fri, Mar 22, 2013 at 2:22 PM, Pratik Mandrekar  wrote:

> Hello,
>
> I'm unable to get the POST json to tastypie from an android http
> client to work.
>
> *I have tried with HttpURLConnection*
>
> urlConnection = (HttpURLConnection) url.openConnection();
>
>
> urlConnection.setDoInput(true)**;
>
>  urlConnection.setDoOutput(**true);
>
>  urlConnection.**setRequestProperty("Content-**Type",
> "application/json");
>
> byte [] encoded = 
> Base64.encode((username+":"+**password).getBytes("UTF-8"),
> Base64.DEFAULT);
>
>  urlConnection.**setRequestProperty("**Authorization", "Basic "+
> new String(encoded, "UTF-8"));
>
>
> JSONObject jsonObject = new JSONObject();
>
> jsonObject.put("key1", "value1");
>
> jsonObject.put("key2", "value2");
>
>   outputStreamWriter = urlConnection.getOutputStream(**);
>
>  outputStreamWriter.write(**jsonObject.toString().**getBytes());
>
>  outputStreamWriter.flush();
>
>
>
>
> *And I have tried with Apache 

first steps with django

2013-03-24 Thread My Wasteland
Hi list,

I am a Django newbie. I have been going through the official tutorial on my 
local machine. I have got some general questions:

1. Where should I develop my Django applications? Should I still do it on 
my local machine and then transfer them somehow to a hosting provider I'm 
with? Or should I develop it straight on a hosting provider's server 
(hosting provider provides a one-click django installation). 

2. If the development should be on the hosting provider's account (ssh 
access), then could you clarify the following? Imagine want the home page 
to be static (eg. www.example.com) then I want my django app - blog on 
www.example.com/blog, then I'd start a new django app in public_html/blog 
right?

If I'm confusing things, please correct me.

Thank you
Martin

-- 
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 1.5 CBV - DeleteView - CustomQuery

2013-03-24 Thread Dan Gentry
Agree with Tom that ccbv is a great resource for help with CBVs.  In fact, 
I used it to help me with this comment.

I would probably override the delete() method in DeleteView to do what you 
want to do.  The original justs deletes the record and redirects to the 
supplied URL:


   1. def delete(self, request, *args, **kwargs): 
   2. """ 
   3. Calls the delete() method on the fetched object and then 
   4. redirects to the success URL. 
   5. """ 
   6. self.object = self.get_object() 
   7. self.object.delete() 
   8. return HttpResponseRedirect(self.get_success_url())
   
   One could easily replace line 7 with your custom code:
   
   now = datetime.datetime.utcnow().replace(tzinfo=utc)
   self,object.date_deleted = now.strftime("%Y-%m-%d %H:%M:%S")
   self.object.save()
   
   Which would update the date as needed.
   
   Also, I would include the date check in the get_object() method:
   
   def get_object(self,queryset=None)
   obj = super(MyDeleteView,self).get_object(queryset)
   if obj.date_deleted is not None:
   raise Http404
   return obj
   
   Not tested, but will probably work :)
   

-- 
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: SQL Server Support - Does it Exist

2013-03-24 Thread Michael Manfre
Although there is no official support for SQL Server, there are two 
available backends to choose from; django-mssql and django-pyodbc. There 
has also been some recent discussion on the django-developers mailing list 
about SQL Server's support and the idea of having officially recognized 
extensions (see [1]).

[1] https://groups.google.com/d/msg/django-developers/O-g06EM6XMM/Y7PcP5VUzYMJ

I'm the maintainer of django-mssql and have been using it on 
http://www.src.org since Django 1.1 and has upgrade to the Django stable 
version shortly after each release. We're currently on Django 1.4.x and 
plan on upgrading to Django 1.5 in the next few months. Django-mssql 
requires pywin32 and must be run on a Windows server. During the ~1.5 years 
between your post and the previous one in this topic, the django-mssql 
project has made a lot of improvements, including better documentation [2].

[2] http://django-mssql.readthedocs.org/en/latest/

If your web servers are non-windows, then you can use django-pyodbc. The 
google code hosted project [3] is a bit out of date, but there is a 
slightly newer fork available on GitHub [4].

[3] https://code.google.com/p/django-pyodbc/
[4] https://github.com/avidal/django-pyodbc

Regards,
Michael Manfre

On Saturday, March 23, 2013 12:35:08 AM UTC-4, Liang wrote:
>
> Sadly, django doesn't support sql server officially is the only stopper 
> for me to adopt django. 
>
> On Friday, 15 July 2011 09:07:23 UTC+8, Russell Keith-Magee wrote:
>>
>> On Fri, Jul 15, 2011 at 6:03 AM, bruno desthuilliers
>>  wrote:
>> >
>> >
>> > On 14 juil, 23:15, Python_Junkie 
>> > wrote:
>> >> I have searched for the drivers to use the syncdb utility with MS SQL
>> >> Server but have been unsuccessful.
>> >
>> > https://docs.djangoproject.com/en/1.3/ref/databases/
>> >
>> > Django doesn't support MS SQL.
>>
>> Django doesn't provide *official* support MSSQL. However, we do have a
>> supported backend API, and there are several third-party projects that
>> implement MS SQL support [1]. I can't comment on their completeness or
>> stability, but the projects exist.
>>
>> [1] 
>> https://docs.djangoproject.com/en/1.3/ref/databases/#using-a-3rd-party-database-backend
>>
>> 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: RuntimeError: maximum recursion depth exceeded in cmp

2013-03-24 Thread Vernon D. Cole
You have an error in your "models.py" file.  Note that the last message was 
"Validataing models...".

Is there anything in models.py?  In your sample script you never modify it.

On Friday, March 22, 2013 1:23:46 PM UTC-6, tarik setia wrote:
>
>
> 
> I was following the very first tutorial on django website. When i started 
> the server i got an error "RuntimeError: maximum recursion depth exceeded 
> in cmp" as shown in image
> Please 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.