Re: Building composite keys?

2012-04-16 Thread Javier Guerra Giraldez
On Mon, Apr 16, 2012 at 9:24 AM, Roy Smith wrote: > I want (serial, version) to be unique. class Meta unique_together = [('serial','version')] -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Passing parameters to class Meta:

2012-04-16 Thread Javier Guerra Giraldez
On Mon, Apr 16, 2012 at 10:11 AM, Mario Gudelj wrote: > I think I need to somehow pass the business object to model = Payment inside > the Meta class... how many 'business' options are there? if it's a fixed num, you could add a Proxy 'subclass' for each one that simply provides the apropriate p

Re: Passing parameters to class Meta:

2012-04-16 Thread Javier Guerra Giraldez
On Mon, Apr 16, 2012 at 11:08 AM, Tom Evans wrote: > Surely you would want what business a payment relates to to be stored > directly in the database?! At which point it simply becomes an > additional field in your payment model, and the only problems come > with automatically populating that fiel

Re: High Traffic

2012-04-16 Thread Javier Guerra Giraldez
On Mon, Apr 16, 2012 at 2:25 PM, Yarden Sachs wrote: > * COUNTING THE RESULTS IS NOT THE POINT ok, then that len(User.objects.all()) is not an appropriate benchmark, right? what you're doing is a view that fetches all 9K records from the DB, without any filtering. will your views do that? usua

Re: High Traffic

2012-04-16 Thread Javier Guerra Giraldez
On Mon, Apr 16, 2012 at 3:49 PM, Yarden Sachs wrote: > when i try to do it from client, it takes 0.7 secs to come back with > response, if try to do it from 10 parralel client, it takes 15 secs for one > http response! well, if you do a heavy and memory intensive task, then doing it ten times is

Re: High Traffic

2012-04-17 Thread Javier Guerra Giraldez
On Mon, Apr 16, 2012 at 3:59 PM, Yarden Sachs wrote: > it took 20 times more for EACH request. that means that if 20 users accross > the web ask for differrent heavy data- instead of taking a second for each > one, every user will wait for 20 seconds before the response will answer. so the total

Re: 'too many SQL variables' error with ModelMultipleChoiceField

2012-04-23 Thread Javier Guerra Giraldez
On Mon, Apr 23, 2012 at 3:58 AM, akaariai wrote: > The last one, qs.filter(id__in=large_list) is pretty much impossible to fix. what's wrong with: qs.filter((Q(id__in=large_list[:n])|Q(id__in=large_list[n:]))) ? >   1. Use different database. I guess you have a reason to use SQLite so this > m

Re: keep models simple ? where to put the business logic ?

2012-04-23 Thread Javier Guerra Giraldez
On Mon, Apr 23, 2012 at 6:47 AM, bruno desthuilliers wrote: > Models - like any other module - should indeed be "as simple as > possible", _but not simpler_. If you concern is about your models.py > file size, it might be time to refactor it into a package. or maybe the app has to be more focused

Re: unique=True doesn't work

2012-05-11 Thread Javier Guerra Giraldez
On Fri, May 11, 2012 at 3:16 PM, . wrote: > It should raise an exception, but there is no one. > (username's unique=True works.) my guess: the IPAddress field didn't have unique=True at first, but it was added afterwards. the syncdb command doesn't modify existing tables. if you want that, you c

Re: Taggit fragmentation

2012-05-29 Thread Javier Guerra Giraldez
On Tue, May 29, 2012 at 2:46 AM, Simon Bächler wrote: > I believe that if you publish a repo and you are the main contributor then it > is your responsibility to maintain it. that's not how it works, fortunately. if you (or anybody) write something, you're free to share it. that's it. no resp

Re: Is Django Right for Me?

2012-05-29 Thread Javier Guerra Giraldez
On Tue, May 29, 2012 at 7:33 AM, KevinE wrote: > Just one question - why would django avoid an offline mode - is that a > completely unreasonable/undo-able extension? Django is a web server framework. when you're offline, you don't have a server. > It seems to me that smartphones > may eventual

Re: Scaling django installation

2012-06-01 Thread Javier Guerra Giraldez
On Fri, Jun 1, 2012 at 3:56 AM, Subhranath Chunder wrote: > how should we measure response complexity? a simple first approximation is the number of DB queries per page. the debug toolbar nicely gives that figure while developing. -- Javier -- You received this message because you are subscr

Re: Django/Python Circular model reference

2012-06-01 Thread Javier Guerra Giraldez
On Fri, Jun 1, 2012 at 10:42 AM, Jak wrote: > Each answer has > a question, and each question has an answer use OneToOneField relationships (https://docs.djangoproject.com/en/1.4/ref/models/fields/#onetoonefield) -- Javier -- You received this message because you are subscribed to the Google

Re: setting debug to false

2012-06-08 Thread Javier Guerra Giraldez
On Fri, Jun 8, 2012 at 11:53 AM, Nenad Cikic wrote: > is there any known reason why I can not see my static files when setting > debug to false in the settings.py? > Just setting debug to True all is OK. you need to run the collectstatic management command (https://docs.djangoproject.com/en/1.4/r

Re: Django hosting on heroku - any experiences?

2012-06-11 Thread Javier Guerra Giraldez
On Mon, Jun 11, 2012 at 4:42 PM, Cal Leeming [Simplicity Media Ltd] wrote: > There's a huge difference between hosting servers in the cloud, and hosting > applications in the cloud. my general impression is that PaaS can be very nice, but sice there's no real standards in place, you end up locked

Re: Django hosting on heroku - any experiences?

2012-06-11 Thread Javier Guerra Giraldez
On Mon, Jun 11, 2012 at 4:56 PM, Cal Leeming [Simplicity Media Ltd] wrote: > As such - I get the impression that any developer who knows how to maintain > a stack, will most likely shy away from such a service. wasn't Heroku initially for RoR only? that might explain that "selling point"... --

Re: Taking advantage of multiple cores

2012-06-22 Thread Javier Guerra Giraldez
On Fri, Jun 22, 2012 at 9:35 AM, Oleg Korsak wrote: > > That's what mod_wsgi does! exactly. specifically, Django is by itself, a shared-nothing library. that means that you can run many instances of it. not only on several cores but also on many different hosts. Just be sure that anything tha

Re: Logout- Back Button

2012-06-26 Thread Javier Guerra Giraldez
On Mon, Jun 25, 2012 at 9:17 PM, Sajja1260 wrote: > On Friday, 28 November 2008 14:35:48 UTC+5:30, jai_python wrote: >> >> Any possible to clear browser cache alone using javascript? it ill >> help to solve this back button problem. cache and history are two different things. -- Javier -- You

Re: ManyToManyField is this right?

2012-06-27 Thread Javier Guerra Giraldez
On Wed, Jun 27, 2012 at 8:57 AM, David Wagner wrote: > With that said, I'm having trouble wrapping my brain around the ManyToMany > and Many-To-One and OneToOne concepts. I'm trying to create a multi-select > option for a user profile in which a user can have multiple attributes of a > certain kin

Re: advantages and disadvantages of Raw sql queries in django

2012-06-30 Thread Javier Guerra Giraldez
On Sat, Jun 30, 2012 at 1:33 AM, Mike Dewhirst wrote: > I firmly believe in using the ORM for everything until i am forced to use > handwritten SQL. absolutely agree > I could also argue against custom SQL because it contains business logic and > i prefer to keep that all in one place, ie., in

Re: advantages and disadvantages of Raw sql queries in django

2012-06-30 Thread Javier Guerra Giraldez
On Sat, Jun 30, 2012 at 5:26 PM, Nick Apostolakis wrote: > Interesting idea, I haven't used that yet, could you give an example of > that? > Would you use a method calling the ORM that would include something like > self.objects.select_related().bla bla? for example: when modelling the requested/

Re: Conditionals in Templates

2012-07-03 Thread Javier Guerra Giraldez
On Tue, Jul 3, 2012 at 3:39 PM, Bill Freeman wrote: > The obvious ways are: > > 1. Provide a model method that returns a string representing the type > of the instance, compare against that > 2. Decorate the instance with an attribute giving the name of the type > as a string... 3. write a templa

Re: Django connection pooling using sqlalchemy connection pool

2012-07-12 Thread Javier Guerra Giraldez
On Wed, Jul 11, 2012 at 6:45 PM, Russell Keith-Magee wrote: > There is a reason that Django doesn't manage connection pooling -- > it's because it's handled quite well by third party tools like pgPool. is there any similar tool for mysql? i've seen a few, but doesn't look so well accepted as Pos

Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-12 Thread Javier Guerra Giraldez
On Thu, Jul 12, 2012 at 2:37 PM, Cal Leeming [Simplicity Media Ltd] wrote: > Just a reminder that the poll will be closing in two days time, if you > haven't already booked, please do so now! I thought somebody asked this but can't find it now... is there any recording of the first one available

Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-13 Thread Javier Guerra Giraldez
On Fri, Jul 13, 2012 at 6:25 AM, Cal Leeming [Simplicity Media Ltd] wrote: > Sadly, the original is not available due to bad sound quality, poor planning > and out of date information. then count me in! (not that i prefer to see it recorded, i just wanted to check a 'preview') -- Javier -- Y

Re: one field of modelForm doesn't being displayed

2012-07-18 Thread Javier Guerra Giraldez
On Wed, Jul 18, 2012 at 5:48 AM, mapapage wrote: > Of course, i don't wanna change the thing that it is not nullable. then what do you want to insert there? you can either define a default value, add a hidden field to the form, or in the view add some value to the user input before feeding to th

Re: Two identical pages but only one works

2012-07-23 Thread Javier Guerra Giraldez
On Mon, Jul 23, 2012 at 1:20 PM, twelve_o_clock wrote: > return render_to_response('micropost/micropost_list.html', > {'mposts',mposts}) is that copy/paste? check the dictionary syntax, it should be {'mposts':mposts} -- Javier -- You received this message because you are subscribed to t

Re: MySQL total overheat (somewhat complex database)

2012-07-28 Thread Javier Guerra Giraldez
On Sat, Jul 28, 2012 at 1:44 PM, lubos wrote: > MySQL, however, isn't able to process it and after few minutes it holds all > processor performance. that looks like a rather simple star scheme. maybe there are missing indexes... were those tables created by Django? -- Javier -- You received

Re: returning a zip file for download

2012-07-31 Thread Javier Guerra Giraldez
On Tue, Jul 31, 2012 at 5:03 PM, Tomas Neme wrote: > The weird thing is that I'm getting just a pdf file (ok, I'm testing with a > single file, so I don't know if that's the problem) shoot in the dark: maybe the browser is interpreting the zipped PDF as a zip-encoded response, and decoding it for

Re: Demise of Mr. Kenneth Gonsalves

2012-08-03 Thread Javier Guerra Giraldez
On Fri, Aug 3, 2012 at 10:12 AM, Anoop Thomas Mathew wrote: > With my heartfelt condolence, I'd like to inform you all the unfortunate > demise of Mr.Kenneth Gonsalves (KG - law...@thenilgiris.com), who was a > strong advocate of Python, Django and Free Software in India. certainly sad news.

Re: Separate file stream from request input stream while upload

2012-08-08 Thread Javier Guerra Giraldez
On Wed, Aug 8, 2012 at 3:05 AM, Russell Keith-Magee wrote: > Not really. This isn't something that's Django specific -- it's a > general problem with web browsers. Web browsers make requests. > Background requests are still requests, and they need to happen in the > context of a page that is in th

Re: Test driven development in Django framework

2012-09-05 Thread Javier Guerra Giraldez
On Wed, Sep 5, 2012 at 7:46 AM, jyria wrote: > What is your experience? Is it worth it, and is it possible? > > I tried it and found it quite difficult to follow guideline of unit testing > -- testing a unit of code, a class for example. Maybe Im just ignorant, but > I didnt see, how can I create

Re: Seeing if a variable value is within a dictionary key value within a list of dictionaries

2012-09-08 Thread Javier Guerra Giraldez
On Fri, Sep 7, 2012 at 6:19 PM, Tim Chase wrote: > On 09/07/12 16:06, Jason Whatford wrote: >> P.s. Tim, my data structure isn't that malleable. It's >> essentially I query my appengine datastore, and that retrieves a >> list of the data models, each of which can be treated as a dict. >> The dicts

Re: Development server won't work from a shared web host

2012-09-08 Thread Javier Guerra Giraldez
On Sat, Sep 8, 2012 at 12:55 AM, graeme wrote: > Why Mako? As a personal preference it is fine, but why general advice for > newbies? Many people are happy with Django templates - although I far prefer > Jinja which had the advantages without some of the more annoying > restrictions. after a quic

Re: Virtualenv changes url reverse behaviour

2012-09-08 Thread Javier Guerra Giraldez
On Sat, Sep 8, 2012 at 5:06 AM, William Hart wrote: > Hey Ramiro, thanks for the reply... yes you are correct I haven't mentioned > the version of Django I have installed. I've experienced this on both 1.4.1 > and 1.5dev. I think I mentioned in the comments on SO that I've installed > and uninst

Re: Announcement of GUI for Creating Models

2012-09-08 Thread Javier Guerra Giraldez
On Fri, Sep 7, 2012 at 9:42 PM, Timothy Clemans wrote: > I've developed a GUI for creating models, see > https://github.com/timothyclemans/django-admin-models-editor > > Would this be helpful for developers? Would it be useful for you? Should I > keep developing it? What features would you like to

Re: Understanding the use of Apache and nginix with Django

2012-09-08 Thread Javier Guerra Giraldez
On Sat, Sep 8, 2012 at 9:49 AM, Reginald Choudari wrote: > Django doesn't serve files itself; it leaves that job to whichever Web > server you choose. > We recommend using a separate Web server -- i.e., one that's not also > running Django -- for serving media. Here are some good choices: some ti

Re: Newbie Project Setup and Terminology Questions

2012-09-12 Thread Javier Guerra Giraldez
On Tue, Sep 11, 2012 at 4:56 PM, Matthew Woodward wrote: > Any thoughts/pointers/admonitions/etc. are greatly appreciated. what i typically do: commonly, i have several projects running, each one involves more than just one django project. maybe two django projects, more usually just one django

Re: Alternatives to CBVs (class based views)

2012-09-12 Thread Javier Guerra Giraldez
On Wed, Sep 12, 2012 at 11:58 AM, Cal Leeming [Simplicity Media Ltd] wrote: > So, here is a really minimalistic way of having class based views, without > the fuss. > > http://djangosnippets.org/snippets/2814/ looks nice. i like that it respects the idea that views in Django are just callables t

Re: Django Unobtrusive Ajax

2012-09-21 Thread Javier Guerra Giraldez
On Thu, Sep 20, 2012 at 7:12 PM, Russell Keith-Magee wrote: > In the case of Real-time, the answer is maybe. Serving real-time data > will probably require some modifications to core -- the mechanisms > used to serve real-time data are different to traditional 'static > page' mechanisms. I guess

Re: View.py v models.py

2012-09-26 Thread Javier Guerra Giraldez
On Wed, Sep 26, 2012 at 5:50 PM, Lachlan Musicman wrote: > Do people have internal guidelines about when they make something a > method on a model rather than a view function? if it's not a presentation thing, it probably goes in the model even some presentation things go there, like the __unico

Re: django and mysql versions

2012-09-30 Thread Javier Guerra Giraldez
On Sun, Sep 30, 2012 at 12:38 PM, Dennis Lee Bieber wrote: > The main features that have been added to MySQL are views, triggers, > stored procedures... And "prepared statements". I beg to differ: http://dev.mysql.com/doc/refman/5.0/en/create-view.html http://dev.mysql.com/doc/refman/5.0/e

Re: Add your own template library

2012-10-01 Thread Javier Guerra Giraldez
On Sun, Sep 30, 2012 at 11:59 PM, Ashish Jain wrote: > After which I am referring it into my website. ... and on settings.py? -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googleg

Re: Creating a custom mixin for use with the generic CreateView

2012-10-04 Thread Javier Guerra Giraldez
On Thu, Oct 4, 2012 at 4:55 PM, Guruprasad L wrote: > This is the first time I am using mixins in code. I read mixed opinions > about mixins, a few of them saying that it is bad. If it is bad, is there > some other way to implement this? regardless of any moral issues for or against mixins, this

Re: Newbie question: first project can't connect to MySQL

2012-10-05 Thread Javier Guerra Giraldez
On Fri, Oct 5, 2012 at 3:02 PM, Kurtis Mullins wrote: > Also, if memory serves me correctly, MySQL may be setup to allow connections > from 127.0.0.1 but not Localhost AFAIK, there are at least three different ways to connect to a local server, each can be allowed/denied individually: A: unix so

Re: Javascript encoding and python decoding and vice versa

2012-10-09 Thread Javier Guerra Giraldez
On Tue, Oct 9, 2012 at 12:07 AM, Laxmikant Gurnalkar wrote: > I am doing a high security data transfer. The things are showstopper to > transferring data through javascript to the python. Is it possible to hide > data or send data over web in that should not be human readable. i would start chec

Re: Javascript encoding and python decoding and vice versa

2012-10-09 Thread Javier Guerra Giraldez
sorry, broken links: Stanford Javascript Crypto Library http://crypto.stanford.edu/sjcl/ crypto-js http://code.google.com/p/crypto-js/ -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-

Re: Object Serializer

2012-10-10 Thread Javier Guerra Giraldez
On Tue, Oct 9, 2012 at 8:10 PM, Victor Manuel Quiñones Victor wrote: > I need to serialize some objects and save them into the database. What > library would you suggest for it? there are a few options, each with different pros/cons. roughly in order of personal preference: JSON: pro: works in

Re: Javascript encoding and python decoding and vice versa

2012-10-11 Thread Javier Guerra Giraldez
On Thu, Oct 11, 2012 at 3:39 AM, Laxmikant Gurnalkar wrote: > I'm using ssl at all. Still I need some data which is going through Ajax. i'm not sure i understand correctly. do you mean "i'm _not_ using ssl at all", or "i'm using ssl for everything" ?? if the former, then stop reading and turn

Re: Javascript encoding and python decoding and vice versa

2012-10-11 Thread Javier Guerra Giraldez
On Thu, Oct 11, 2012 at 10:04 AM, Kurtis Mullins wrote: > If you use GET requests to transmit data, there is still a chance that the > data might be intercepted by a DNS server or Proxy Server regardless of SSL. > I'd keep everything contained in POST and just like the others have > mentioned, sim

Re: Javascript encoding and python decoding and vice versa

2012-10-11 Thread Javier Guerra Giraldez
On Thu, Oct 11, 2012 at 10:25 AM, Kurtis Mullins wrote: > Sorry, you're probably right. I imagine there are no security risks related > to pulling a host-name from a DNS server. However, I do not know if the case > is the same for an HTTP Proxy when the query is included in the URL. a malicious D

Re: Javascript encoding and python decoding and vice versa

2012-10-11 Thread Javier Guerra Giraldez
On Thu, Oct 11, 2012 at 11:09 AM, Kurtis Mullins wrote: > On the other hand, some valid points raised against storing sensitive data > in a Query String: > http://stackoverflow.com/questions/323200/is-a-https-query-string-secure oh, yes; the browser URL cache. effectively, that's part of the 'o

Re: Image/Photo app

2012-10-12 Thread Javier Guerra Giraldez
On Fri, Oct 12, 2012 at 9:41 AM, Kurtis Mullins wrote: > I'm not sure about the syncing of tags between the GUI and Web Application; > I think that would completely depend on your ability to export or otherwise > use the tags created by the GUI application. If you can figure out how to > get ahold

Re: Puzzled about WSGI vs. FastCGI

2012-10-24 Thread Javier Guerra Giraldez
On Wed, Oct 24, 2012 at 10:58 AM, Fred wrote: > This article says: >> >> Although WSGI is the preferred deployment platform for Django, many people >> use shared hosting, on which protocols such as FastCGI, SCGI or AJP are the >> only viable options. > > > I'm puzzled, because I seemed to understa

Re: Help me choose OS for django server

2012-10-31 Thread Javier Guerra Giraldez
On Wed, Oct 31, 2012 at 2:17 PM, Chris Pagnutti wrote: > Hi Waitman, > > Do you mean that if I stream mp4 videos from my site, I have to pay someone > royalties? maybe, maybe not. the point is that H.264 is not free, not gratis, not open. but there's a "free of charge" use-case as a gift from

Re: How do you extend a queryset object with another queryset as in list.extend(another_list)

2012-11-06 Thread Javier Guerra Giraldez
> filterList = accounts.objects.filter(name="foo", company="bar", blah blah blah..) > > itemsList = items.objects.filter(account__in=accountList, status="delivered", andSo="on") > > Not sure if I understand it correctly, but shouldn't this work better? items list=items.objects.filter(status="

Re: Django mod-wsgi multiple instances of One Class object

2012-11-06 Thread Javier Guerra Giraldez
On Mon, Nov 5, 2012 at 1:07 PM, drunksaint wrote: > This model was running perfectly in the DEV deployement. When I moved to > PROD in apache, this broke (as in there are multiple instances of scObj > being created, so a score update from player-1's move on player-2 is not > reflected in a differe

Re: google app engine suggestion

2012-11-09 Thread Javier Guerra Giraldez
On Fri, Nov 9, 2012 at 11:53 AM, Aswani Kumar wrote: > my question is google app engine supports python 2.7 but django moving > towards python 3.x now with django 1.5 the minimum required version of > python is 2.6. and django 1.6 will be on python 2.7. what will be my future > if i choose google

Re: google app engine suggestion

2012-11-10 Thread Javier Guerra Giraldez
On Sat, Nov 10, 2012 at 3:51 AM, Kurtis Mullins wrote: > I, personally, prefer Nginx and uWSGI but something else may be better for > your particular use case. same here. it's a little different from other solutions, but rock solid, and includes its own process management, so it's really close t

Re: Queries to multiple tables

2012-11-10 Thread Javier Guerra Giraldez
On Sat, Nov 10, 2012 at 6:15 AM, Tomas Ehrlich wrote: > I usualy put methods like this one into Model, although Manager is also > possible. Definitely not View or sth else. definitely in the model. you'd use it like this: accnt = get_object_or_404 (Account, pk=account_id) payee = get_object_or_

Re: Admin Site appending letter "s" to end of each model\table name

2011-09-11 Thread Javier Guerra Giraldez
On Sat, Sep 10, 2011 at 11:06 PM, Shawn Milochik wrote: > The way you were doing it makes perfect sense if you have experience > creating database tables by hand, the way most people do for their PHP and > ASP apps. Django's ORM is doing all the same stuff underneath, but it > provides a level of

Re: sending and receiving data using ajax/html

2011-09-16 Thread Javier Guerra Giraldez
On Thu, Sep 15, 2011 at 10:51 AM, jay K. wrote: > I do not know anything about send and receiving data using forms in html > django, > I just heard that ajax was good for receiving and sending data (it was > faster) no, it's not. it can create the illusion if used with an appropriately designed

Re: Populating form and having access to related objects

2011-09-16 Thread Javier Guerra Giraldez
On Fri, Sep 16, 2011 at 10:35 AM, David wrote: > def companyedit(request, pk): >    if request.method == 'POST': >        a = Company.objects.get(pk=pk) .. > I would like to fetch the related Person objects that are related to > Company (ie. those who work for said company). I don't intend to

Re: Populating form and having access to related objects

2011-09-16 Thread Javier Guerra Giraldez
On Fri, Sep 16, 2011 at 10:57 AM, David wrote: > I had imagined therefore I would be able to iterate through the > Person's that belong to the Company using the following syntax: > > {% for p in person %} >        {{ p.first_name }} > {% endfor %} > > But I'm told that the company object is not it

Re: [Share] Google+ and Django

2011-09-19 Thread Javier Guerra Giraldez
On Sun, Sep 18, 2011 at 1:17 PM, Subhranath Chunder wrote: > I've probably made the first attempt to integrate the Google+ with Django > authentication backend, in the form a pluggable Django app. doesn't Google+ use oauth? -- Javier -- You received this message because you are subscribed to

Re: Python Weekly

2011-09-26 Thread Javier Guerra Giraldez
On Mon, Sep 26, 2011 at 12:43 PM, Rahul wrote: > started a free weekly newsletter called Python Weekly make it an RSS, and on a readable format (not a single PNG), and I'm in. right now, it's too much like spam techniques for my taste. (not saying that it's spam, only that you're using the same

Re: CSRF with AJAX problem

2011-09-29 Thread Javier Guerra Giraldez
On Thu, Sep 29, 2011 at 6:23 PM, galgal wrote: > How can I make that cookie without using csrf tag? right there in the code sample you quoted: xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); where getCookie() is defined as: function getCookie(name) {        var cookieValue =

Re: CSRF with AJAX problem

2011-09-29 Thread Javier Guerra Giraldez
On Thu, Sep 29, 2011 at 7:15 PM, galgal wrote: > Yes, but that JavaScript code is useless until {% csrf_token %} or get_token > is used. I don't use POST forms - only AJAX forms so I don't have that > cookie made after page load. have you read it? -- Javier -- You received this message becaus

Re: How REST Access ?

2011-10-03 Thread Javier Guerra Giraldez
On Fri, Sep 30, 2011 at 10:23 PM, bino oetomo wrote: > Dear All. > > Kindly please give me your enlightment to CRUD Django database using > HTTP-GET. first of all, REST is not CRUD. you'll get in a world of pain if you simply expose your database. second, check Django-Piston. even if you don

Re: how to match a url in urls.py

2011-10-03 Thread Javier Guerra Giraldez
On Mon, Oct 3, 2011 at 9:56 AM, He Jibo wrote: >    (r'^pagerank/(?P([/w-]+/.)+[/w-]+.([^a-z])(/[/w-: > ./?%&=]*)?|[a-zA-Z/-/.][/w-]+.([^a-z])(/[/w-: ./?%&=]*)?)', > 'ueseo.pagerank.views.CheckPageRankStatic'),# a static page version of page > rank check is that a copy/paste? i think you're usin

Re: Combining Querysets from different, but similar models

2011-10-05 Thread Javier Guerra Giraldez
On Wed, Oct 5, 2011 at 8:37 AM, Steven Smith wrote: > What's the cheapest way to do my queries and mix the results into one > feed? I'd say to do it in Python. a simpler case: you have two querysets and want a single 'feed' with results of one query followed by the other: from itertools imp

Re: Beginner a bit lost - need some pointers please

2011-10-05 Thread Javier Guerra Giraldez
On Wed, Oct 5, 2011 at 2:55 PM, Chris G wrote: > I'm trying to get my mind round django.  I have it installed on my > unbuntu server, it works, I've worked through tutorials 1 and 2 and a > bit of 3.  I can get the admin screens up and the basics of the polls > example work. just finish the tutor

Re: Beginner a bit lost - need some pointers please

2011-10-05 Thread Javier Guerra Giraldez
On Wed, Oct 5, 2011 at 3:20 PM, Ivan Ivanov wrote: >> about how to write, check the paragraph about the MTV architecture: > > If you are familier with MVC (Model, View, Controller), MTV is the same > but with different component names. sorry, but no. a Django view is way different from an MVC vi

Re: @transaction.commit_on_success, not getting expected results

2011-10-05 Thread Javier Guerra Giraldez
On Wed, Oct 5, 2011 at 8:15 PM, robinne wrote: > @transaction.commit_on_success > def Test(request): >    try: >        member = request.user.get_profile() >        Credit.objects.create(CreditDate=datetime.datetime.now(), > Member=member, CreditAmount=25) >        Credit.objects.create(CreditDate

Re: How to get topics user replied?

2011-10-06 Thread Javier Guerra Giraldez
On Thu, Oct 6, 2011 at 9:41 AM, David.D wrote: > It work: > > Topic.objects.filter(pk__in=[comment.content_object.pk for comment in > Comment.objects.filter(user__exact = request.user)]) or: Topic.objets.filter (comments__user=request.user) if you add a 'reverse generic relation' field to Topi

Re: Why can't "directly" change array elements of model objects in Django shell?

2011-10-07 Thread Javier Guerra Giraldez
On Fri, Oct 7, 2011 at 10:39 AM, Jacob Kaplan-Moss wrote: >> *Sometimes* the first works and I don't know why. > > This is because `MyModel.objects.all()` isn't a list; it's a QuerySet. > That is, `MyModel.objects.all()` *doesn't* hit the database until you > say `x[3]`, at which point Django perf

Re: Easy question (I hope)

2011-10-07 Thread Javier Guerra Giraldez
On Fri, Oct 7, 2011 at 10:57 AM, Calvin Spealman wrote: > On Fri, Oct 7, 2011 at 10:39 AM, bcrem wrote: >> Howdy, >> >> I come from a C/C++ background, getting into some django/python now. >> I'm used to a one-class/one-file paradigm, and don't much like >> sticking all the models for an app in m

Re: can't use django session object

2011-10-07 Thread Javier Guerra Giraldez
On Fri, Oct 7, 2011 at 11:41 AM, django-jython-user wrote: > Hi, > I'm having trouble using django sessions objects. > > so I set the object in one view: > request.session['user_cred']=cred #where cred is a GlobusCredential the session object does automatic pickling of object to store them. but t

Re: Easy question (I hope)

2011-10-07 Thread Javier Guerra Giraldez
On Fri, Oct 7, 2011 at 1:06 PM, bcrem wrote: >  I don't think this format is > S eccentric that a python purist who comes along later to maintain > my code can't figure it out pretty quickly. nobody said that. what we're saying is: 1- one-model/one-file isn't a goal by itself. nothing wron

Re: Easy question (I hope)

2011-10-07 Thread Javier Guerra Giraldez
On Fri, Oct 7, 2011 at 2:31 PM, Oscar Carballal wrote: > Should I split it? Why? you already have. splitted in apps, which is often the best way. but, since most of the 'business methods' code should be in the model (and not in the views as many PHP-refugees tend to do), sometimes a models.py

Re: How to do equivalent of LEFT JOIN ON in Django (returning all Left rows, when Right item may not exist)

2011-10-08 Thread Javier Guerra Giraldez
On Sat, Oct 8, 2011 at 8:18 AM, Michal Petrucha wrote: > Behind the scenes, Django does a JOIN. Its type (INNER od LEFT OUTER) > is decided based on whether the left-hand column (your ForeignKey > field) is allowed to be NULL or not. the weird part, is that is takes the same choice on reverse rel

Re: Trivial view sometimes fails in Chrome

2011-10-11 Thread Javier Guerra Giraldez
On Tue, Oct 11, 2011 at 11:39 AM, Pigletto wrote: > I've just noticed that switching off 'keep-alive' at Cherokee solves this > problem, so issue might be related to Cherokee... though I'm not sure - why > it works after placing call to request.POST in my view? sounds like Cherokee needs that the

Re: Ajax replacement in django

2011-10-12 Thread Javier Guerra Giraldez
On Wed, Oct 12, 2011 at 9:17 AM, lankesh87 wrote: >  I am developing a web application where i need ajax like features. > But I don't want to use ajax, so my question is- "is there any way to > perform ajax like functions in django?" that kind of specifications (ajax-like but no ajax) sound very

Re: Ajax replacement in django

2011-10-12 Thread Javier Guerra Giraldez
On Wed, Oct 12, 2011 at 9:39 AM, lankesh87 wrote: > I mean if we could only refrsh particular part in our web page without > refreshing the whole page "using django". i think you really need to check how HTTP works. in HTTP, the server can't "push" anything to the browser. the browser has to as

Re: Create a modular application

2011-10-12 Thread Javier Guerra Giraldez
On Wed, Oct 12, 2011 at 11:14 AM, Guillaume DE BURE wrote: > Being still quite new to django, I have some very basic questions on this: > * Should each module be         a django app ? Or is it something different ? > * Is there already something existing (a third party app ?) to provide this > ki

Re: UML Diagrams

2011-10-13 Thread Javier Guerra Giraldez
On Thu, Oct 13, 2011 at 12:34 AM, Apurv Verma wrote: >  I am making a web application in Django. What tools are available to > create class diagrams which can then later autogenerate the code > template for it. i do it the other way: generate diagrams from the models definition. (django-extensio

Re: Second coming of Java?

2011-10-13 Thread Javier Guerra Giraldez
On Thu, Oct 13, 2011 at 9:52 AM, Maksymus007 wrote: > must works with some other solutions where choice of using SOAP over REST > was made years ago. often because some years ago, REST wasn't a buzzword-compliant acronym. anybody who suggested CRUD-over-HTTP (*) would've been quickly vetoed out

Re: Second coming of Java?

2011-10-13 Thread Javier Guerra Giraldez
On Thu, Oct 13, 2011 at 12:12 PM, Marc Aymerich wrote: > I'm not sure if SSDs can speed up a DB server so much. Now a days the > 'normal' enterprise server has 24GB of memory, so at least that your > database is a huge one, you don't need to constantly query your disks > anymore. the big (BIG) di

Re: Templates available to a cluster

2011-10-19 Thread Javier Guerra Giraldez
On Wed, Oct 19, 2011 at 5:17 PM, Kurtis Mullins wrote: > Good idea. I'm going to check out MongoDB for this. Looks like there's > already some Django tools for it out there. > > On Wed, Oct 19, 2011 at 5:57 PM, Donald Stufft > wrote: >> >> If I wanted maximum performance from a distributed on the

Re: .count() returning unexpected results

2011-10-19 Thread Javier Guerra Giraldez
On Wed, Oct 19, 2011 at 8:35 PM, Tim Chase wrote: > I understand what it's doing at a SQL level, but not sure if this is a > "correct" behavior for .count() or the resulting list of objects. > > Any thoughts/suggestions? usually adding .distinct() to the queryset makes it less surprising -- Jav

Re: How do you pinpoint a performance issue?

2011-10-21 Thread Javier Guerra Giraldez
On Fri, Oct 21, 2011 at 2:08 PM, Shawn Milochik wrote: >    What's the best way to start looking for a problem like this? I Django-debug-toolbar is the first line of defense (well, second. the first is to use good algorithms). in the vast majority of cases, any performance issue is because too

Re: Deploying Django

2011-10-26 Thread Javier Guerra Giraldez
On Wed, Oct 26, 2011 at 5:14 PM, sakthi wrote: > i installed mod_python and that's where you got it wrong. mod_python is obsolete and deprecated. the supported way to deploy python apps with apache is mod_wsgi. check https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/ --

Re: No module named django after upgrade to os x Lion

2011-10-27 Thread Javier Guerra Giraldez
On Thu, Oct 27, 2011 at 9:20 AM, Kurtis Mullins wrote: > If you don't want to use the complexity of the virtual environment, just run > "sudo easy_install django" or "sudo pip install django" from your terminal. > This will install Django system-wide. the same commands work inside a virtualenv. w

Re: Which Linux distro to use on EC2?

2011-11-13 Thread Javier Guerra Giraldez
On Sun, Nov 13, 2011 at 8:52 PM, ydjango wrote: > I was concerned that Ubuntu being a desktop OS might have some > limitations which CENTOS or Debian being Server OS might not have. AFAICT, there are very few differences between 'server' and 'desktop' distros: - server distros don't have desktop

Re: Slow page load

2011-11-18 Thread Javier Guerra Giraldez
On Fri, Nov 18, 2011 at 10:55 AM, Dre wrote: > It takes 8096 msec for a model with 1000 database rows to be opened > using the admin interface with debug-toolbar enabled. It is paginated > to > 100 entries per page, and SQL makes 339 queries in 128.77 msec. > I have two foreign keys on this model

Re: Beginner: how to display the list of records with subrecords?

2011-11-20 Thread Javier Guerra Giraldez
On Sun, Nov 20, 2011 at 12:05 PM, Petr Přikryl wrote: > I tried the tutorial, and I like it, but it is too much of new things > for me. but all these new things are needed to solve your problem. for us (or anybody) to help you, we'd need first a common language, or else we would waste lots of ti

Re: Editable datagrid

2011-11-24 Thread Javier Guerra Giraldez
On Thu, Nov 24, 2011 at 6:28 AM, Gabriel - Iulian Dumbrava wrote: > I have successfully used jqgrid. It's very customizable and you have > inline editing and form editing. same here. slicktables looks very good too, but documentation is lacking, so i haven't really tried it yet -- Javier --

Re: Massive memory leak -- seeking help

2011-11-25 Thread Javier Guerra Giraldez
On Fri, Nov 25, 2011 at 11:01 AM, Alvin Mites wrote: > the server itself is running with > 16GB of memory and over time it is all being consumed the the apache > process are you running mod_wsgi in 'embedded' mode? because in 'daemon' mode (the recommended mode in most cases, AFAIK) the python p

Re: Security design questions

2011-11-28 Thread Javier Guerra Giraldez
On Mon, Nov 28, 2011 at 2:21 AM, Mike Dewhirst wrote: > 1. Do I have to create many-to-many relationships and before serving a page > make sure the user making the request is "permitted" to see it? that's how i've done this in the past. it's not too much burden. in my case, i had several image

Re: Large Queryset Calculation In Background?

2011-11-28 Thread Javier Guerra Giraldez
On Mon, Nov 28, 2011 at 10:10 AM, Tom Evans wrote: > Django currently always fetches the entire result all at once, > regardless of how you then fetch the data from the queryset. but this result isn't the whole queryset result, it's a chunk of it. the ORM adds 'LIMIT' arguments to the query. I t

<    1   2   3   4   5   >