Re: If logged in show X, if not Y

2010-11-28 Thread Andre Terra
s authenticated" part to the view: if is authenticated: render logged_in.html else: render not_logged_in.html Regards, Andre Terra On Sun, Nov 28, 2010 at 22:50, robos85 wrote: > Hi, > I've read about {% if user.is_authenticated %} and m template is going > to have the s

Re: Django admin photo upload

2010-11-29 Thread Andre Terra
For anyone else who's interested, I've heard great things about sorl-thumbnail too, haven't used it myself. I hope all is fine with easy_thumbnail. Regards, Andre Terra On Mon, Nov 29, 2010 at 10:39, Sithembewena Lloyd Dube wrote: > @Kenneth, thanks again. easy_thumbnail

Re: django to php

2010-11-30 Thread Andre Terra
Because he can't drive stick. Regards, Andre Terra On Tue, Nov 30, 2010 at 16:53, CLIFFORD ILKAY wrote: > On 11/30/2010 02:26 AM, Akash Mukherjee wrote: > >> Hello, >> >> I have a webapp created in django. Now I want to convert the entire >> code int

Re: missing object in object_list generic view

2010-11-30 Thread Andre Terra
Start by reading http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/ and finish by writing one (or many!) wrapper function(s) as suggested. It will make your code 1) readable, 2) easier to debug, 3) extensible, 4) powerful, and 5) DRY. Cheers, Andre Terra On Tue

Re: Error in ajax request

2010-11-30 Thread Andre Terra
Noob question here: why would it need limit=5 if the funcion has default values? Best regards, Andre Terra On Mon, Nov 29, 2010 at 20:17, Daniel Roseman wrote: > On Nov 29, 8:28 pm, James Matthews wrote: > > Hi, > > > > When I use this rate limiterhttp:// > www.levig

Re: Unresolved import in Eclipse

2010-12-01 Thread Andre Terra
he standalone version. Sincerely, Andre Terra On Wed, Dec 1, 2010 at 21:51, cootetom wrote: > I take it you're using PyDev with eclipse? My experience is that > eclipse often says that it can't resolve an import but is wrong. Just > remember an import will work if it is on you

Re: Error in ajax request

2010-12-02 Thread Andre Terra
Ah, gotcha. What was I thinking? It's pretty obvious now :P On Thu, Dec 2, 2010 at 21:37, pjrhar...@gmail.com wrote: > On Dec 1, 2:43 am, Andre Terra wrote: > > Noob question here: why would it need limit=5 if the funcion has default > > values? > > Even if it has

Re: Pre-filled user info in Django Comments?

2010-12-10 Thread Andre Terra
>From my experience, adapting to http://code.google.com/p/django-threadedcomments/ pays off. You said "the site I'm *building*", and we all know it's definitely easier to explore other possibilities early on. Best regards, Andre Terra (airstrike) On Fri, Dec 10, 201

Re: Models inheritance in django: how to change PK "_ptr_id" on "id"?

2012-02-07 Thread Andre Terra
I just read your e-mail quick and somewhat carelessly, so forgive me if I'm missing something. Here's a list of things for you to check: * Have you defined your Client model with abstract = True in its Meta options?[1] * Have you syncdb'd[2]? * If you must name your pk something else, just follo

Re: Django Contract - London - Immediate Start - £250pd - £350pd

2012-02-27 Thread Andre Terra
Meanwhile, as you wait for answers, do check http://djangopeople.me/ Perhaps you could contact some locals directly and even schedule a couple of interviews. Cheers, AT On Mon, Feb 27, 2012 at 12:22 PM, Tim Abbott wrote: > Good Afternoon all, > > Firstly, sorry to use the group like this, how

Re: Post data Query Dict - Why not a list ?

2012-02-29 Thread Andre Terra
On Wed, Feb 29, 2012 at 5:46 AM, Szabo, Patrick (LNG-VIE) < patrick.sz...@lexisnexis.at> wrote: > Should I not get lists ? > > ** ** > > i.e: > > ** ** > > [Monatsreport] > > [2,29,42] > I may be misunderstanding something, but for one reason lists are not ordered, so you'd never kn

Re: Post data Query Dict - Why not a list ?

2012-02-29 Thread Andre Terra
Excuse my brainfart moment.. sets and dicts are not ordered! On Wed, Feb 29, 2012 at 11:32 AM, Tom Evans wrote: > On Wed, Feb 29, 2012 at 1:46 PM, Andre Terra wrote: > > I may be misunderstanding something, but for one reason lists are not > > ordered, so you'd never kn

Re: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread Andre Terra
use something like >>> d + datetime.timedelta(days=365) http://docs.python.org/library/datetime.html#timedelta-objects Cheers, AT On Wed, Feb 29, 2012 at 12:59 PM, furby wrote: > Caught it. Haha. What a funny bug. From models.py: > > 196 d = dt.datetime.today() > 197 expires = d.replace(ye

Re: best resources for learning django

2012-03-02 Thread Andre Terra
First of all, welcome to Django! If you're not familiar with python (and specially managing python packages), I recommend you setup a sane development environment. Namely using virtualenv and pip, and optionally mkvirtualenv (if you're not on windows). Having to figure out import errors is usuall

Using django and virtualenv on Mac OS X. (WAS: Getting Started with Mac OS X)

2012-03-07 Thread Andre Terra
You should use pip and virtualenv to create a sane development environment. This guide [1] is originally aimed at ubuntu/linux, but I think you can probably follow in mac os x as well. I've also listed a few other links with instructions that look alright, but that I haven't tested. Basically, do

Re: Problems getting started

2012-03-07 Thread Andre Terra
On Wed, Mar 7, 2012 at 2:53 PM, Sandro Dutra wrote: > I don't know how it's works on a Linux box, but on Windows we've to put > Python/Scripts on PATH variable to use the command directly. Or you can use virtualenv like I mentioned in the other thread. Cheers, AT -- You received this messa

Re: User permission

2012-03-07 Thread Andre Terra
What I do: 1) Control user rights in views, always, no matter what. 2) Pass user perms to template so that you only display accessible, permitted links. Cheers, AT On Wed, Mar 7, 2012 at 2:10 PM, Xavier Pegenaute wrote: > Hi, > > Which one is the best option? > > a- Control the user rights in

Re: Problems getting started

2012-03-07 Thread Andre Terra
Again, don't install as root, use virtualenv. This will save you headaches in the future, and unless you have an inexcusable reason to have Django run as root, you shouldn't. Sincerely, AT On Wed, Mar 7, 2012 at 6:28 PM, backdoc wrote: > I think you might need to install as root or sudo. > > F

Re: django facebook api

2012-03-12 Thread Andre Terra
Suresh, If you want to get any answers, you must first learn how to make the questions. Please follow the guidelines in this wiki article before posting to the mailing list: https://code.djangoproject.com/wiki/UsingTheMailingList Cheers, AT On Thu, Mar 8, 2012 at 9:24 AM, suresh dokania wrot

Re: "Dynamyc" modells

2012-03-13 Thread Andre Terra
This is so not what Django was built to do... I have a feeling that if you ever do manage to write it, it's going to be slower than slow and error prone... Sincerely, AT On Tue, Mar 13, 2012 at 4:59 AM, Ervin Hegedüs wrote: > hello, > > On Tue, Mar 13, 2012 at 09:38:34AM +0200, Jani Tiainen

Re: [bump] Preventing JOIN while checking if a self referencing FK is null

2012-03-21 Thread Andre Terra
On Wed, Mar 21, 2012 at 5:41 AM, diafygi wrote: > >>> Blog.objects.filter(editor=None) > >>> print Blog.objects.filter(editor=None).values('id').query SELECT "myapp_blog"."id" FROM "myapp_blog" WHERE "myappblog"."editor_id" IS NULL Cheers, AT -- You received this message because you are sub

Re: where did I install Django

2012-03-21 Thread Andre Terra
How to have a sane python setup: 1. use pip and virtualenv[1] 2. ??? 3. PROFIT! Cheers, AT [1] http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/ On Tue, Mar 20, 2012 at 8:30 PM, jdw wrote: > got it! This one worked. Thanks. > > On Tuesday, March 20, 2012 3:52:

Re: Having all objects defined in Models.py editable in one admin page

2012-03-21 Thread Andre Terra
Try writing your own views rather than expanding the Admin. It's well worth it in the long run! Cheers, AT On Wed, Mar 21, 2012 at 1:50 PM, Sithembewena Lloyd Dube wrote: > Hi guys, > > I am building a learning application for a client. The problem we are > experiencing is that of inlines. We h

Re: Problem with Django starting up

2012-03-21 Thread Andre Terra
What I recommend is that you install pip and virtualenv, create a folder (say, C:\virtual\) where you will place different python "environments" per virtualenv, then create a folder (say, C:\projects) where you will create different django projects. This way you can always use virtualenv to "activ

Re: [bump] Preventing JOIN while checking if a self referencing FK is null

2012-03-21 Thread Andre Terra
Because django offers a nice ORM that makes it easy to do most queries, especially one-liners like this one. And refactoring raw SQL is a royal PITA. Cheers, AT On Wed, Mar 21, 2012 at 3:14 PM, Python_Junkie < software.buy.des...@gmail.com> wrote: > Use straight sql. > > There are always poten

Re: Preventing JOIN while checking if a self referencing FK is null

2012-03-21 Thread Andre Terra
rify? > > I'm using Django 1.3 and I get: > >>> print Blog.objects.filter(editor=None).values('id').query > SELECT `myapp_blog`.`id` FROM `myapp_blog` LEFT OUTER JOIN > `myapp_user` ON (`myapp_blog`.`editor_id` = `myapp_user`.`id`) WHERE > `myapp_user`.`id`

Re: using forloop.counter to access data

2012-03-21 Thread Andre Terra
You could always try writing a custom template tag or filter as someone else suggested earlier in the thread before resorting to JavaScript. Cheers, AT On Mar 21, 2012 5:41 PM, "Larry Martell" wrote: > On Wed, Mar 21, 2012 at 12:52 PM, James wrote: > > > > > > On Wednesday, March 21, 2012 10:41

Re: Is there a place for new Django specialized hosting?

2012-03-22 Thread Andre Terra
Forgive me if I sound pessimistic, I'm just a hobbyist developer offering my most sincere 2 cents. There are many services that offer similar features and sometimes even more. From a business perspective, the only way to thrive in this market is by having technology that provides competitive advan

Re: ANNOUNCE: Django 1.4 released

2012-03-23 Thread Andre Terra
Hooray! Congrats to everyone involved, especially all that worked on bringing timezone support to this increasingly amazing web framework. I don't mean to nitpick but a minor detail in the release notes requires some attention: "Django does not support Python 3.x at this time. At some point befo

Re: IE9+Django,Don't respond or Socket error!!!

2012-03-28 Thread Andre Terra
On Mon, Mar 26, 2012 at 11:31 PM, br wrote: > 2) If you want to use the runserver that comes with django: > - to run runserver, use "manage.py runserver 0.0.0.0:8000" instead of > the default (which goes to localhost or 127.0.0.1) , and then figure > out your computer's IP address in your intrane

Re: is doing text manipulations in django's template faster than doing same in views

2012-03-29 Thread Andre Terra
If you're doing a lot of operations with your data, there's a chance it should be moved to the view. The template should usually be restricted to defining *how* data gets displayed, whereas the view defines *what* your data is. Cheers, AT On Thu, Mar 29, 2012 at 7:30 AM, vijay shanker wrote: >

Re: How Admin can be able to configure Model fields

2012-03-29 Thread Andre Terra
Deepak, Please read through this before posting again: https://code.djangoproject.com/wiki/UsingTheMailingList Cheers, AT On Thu, Mar 29, 2012 at 5:04 AM, Deepak RK wrote: > Admin can add another field in any model (lets say UserProfile ) and > it should start appearing in registration form.

Re: Looking for Django IDE

2012-04-02 Thread Andre Terra
OP, there are about a dozen threads regarding django and IDEs in the mailing list. Please search the archive before asking the same question again. Let's try not e-mail thousands of people needlessly! Sincerely, André Terra 2012/4/2 Sells, Fred > Thanks; actually I can use the nightly build f

Profiling Django (WAS Django database-api)

2012-04-03 Thread Andre Terra
While I know of the two methods mentioned by Anssi, I've often wondered how to profile my code from a project level. I have some complex and database intensive asynchronous tasks running under celery which take a LONG time to complete and I'd just love to be able to keep track of the queries they

Re: Problemas con syncdb

2012-04-03 Thread Andre Terra
I guess you could check if you're actually looking at the right file. $ python manage.py shell >>> import settings >>> print settings.__file__ Cheers, AT On Tue, Apr 3, 2012 at 10:28 AM, DIEGO CENZANO PRADO wrote: > I am trying to do the tutorial and I get an error doing 'python manage.py

Re: Need help

2012-04-03 Thread Andre Terra
It could be a regression bug. To be honest, I don't see a reason why '' should become 'localhost' automagically. I'd much prefer if users were forced to write 'localhost' rather than having Django do it (and fail) for them. Explicit is better than implicit. If you haven't yet, please file a bug

Re: Profiling Django (WAS Django database-api)

2012-04-03 Thread Andre Terra
wish there were third party apps and tools for debugging this sort of problem. Thanks again for your input. Cheers, AT On Apr 3, 2012 3:47 PM, "Javier Guerra Giraldez" wrote: > > On Tue, Apr 3, 2012 at 8:21 AM, Andre Terra wrote: > > I have some complex and database inten

Re: dynamically adding form fields

2012-04-03 Thread Andre Terra
Hi Matt, Search the docs for inlines, inline formsets and inline formset factories, and you'll find exactly what you need [0]. Read them carefully cause it's easy to make mistakes and debugging inlines has always been frustrating for me. Good luck and happy coding. Cheers, AT [0] https://docs.

Re: Problem using django-admin.py in a virtual environment

2012-04-04 Thread Andre Terra
When you type 'django-admin.py foo' in a command prompt, windows will use the system wide python install which is what is associated with the .py extension. In order to avoid this, you must call 'python django-admin.py foo'. If you don't like having to type 'python' before calling a script, you ca

Re: Difficult setup on Suse Linux

2012-04-05 Thread Andre Terra
There's a chance you have a logging module in your PATH that is shadowing the default package. Did you create an app or project named logging by any chance? Ideas: - From an interactive python shell, import logging and check logging.__file__ In my Ubuntu install, I get: /usr/lib/python2.7/loggin

Re: Comparing QuerySets

2012-04-05 Thread Andre Terra
Not sure if this is efficient, but you can try wrapping the values_list in a set() call. >>> set(ids1) == set(ids2) True >>> set(ids1) & set(ids2) set([1]) >>> ids3 = set([]) >>> r = set(ids1) & set(ids3) >>> r set([]) >>> len(r) 0 Cheers, AT On Thu, Apr 5, 2012 at 6:07 AM, Thomas Guet

Re: Django ORM - query help

2012-04-12 Thread Andre Terra
On Thu, Apr 12, 2012 at 10:01 AM, David wrote: > Log.objects.distinct('thing__id').order_by('thing__id', > '-modified_on').select_related().filter(thing__deleted=0)[:20] > > By avoiding the use of values() I was able to then use the result as an > object and access everything I needed. > > The ab

Re: Avoid verbose_name HTML escaping in admin

2012-04-13 Thread Andre Terra
I'm only guessing, but I think the escaping is being done at rendering time by the template itself. Take a look at the default admin templates and check the docs for an explanation on how to override them with your own. Protip: do not edit the original files! Cheers, AT -- Sent from my phone, pl

Re: transaction.commit_on_success committing prematurely?

2012-04-24 Thread Andre Terra
This may actually solve one of the problems I've been having regarding slow bulk inserts. I'll look into it, thanks for the pointer!!! Cheers, AT On Tue, Apr 24, 2012 at 2:16 PM, John Begeman wrote: > My app uses multiple databases and my saves were against something > that was not the default

Re: 1.4 on git

2012-05-07 Thread Andre Terra
add "django==1.4" to a requirements.txt file (no quotes!) $ pip install -R requirements.txt On Mon, May 7, 2012 at 1:00 AM, Rivsen wrote: > Hi Larry, > > I cloned django and django-old from github, and I found the git index of > yours. > > It's in django-old repo, not in django. > > So you nee

Re: i need to place my django site on a server, i dont know how to do it! help!!!

2012-05-10 Thread Andre Terra
Or just deploy on heroku http://heroku.com Cheers, AT On Thu, May 10, 2012 at 11:13 AM, eihli wrote: > This won't be a complete list but it's what I can remember off the top of > my head. > Things to do: > Install Python > Install Django > Install database software (I chose Postgres. I guess

Re: New Release of IBM_DB_DJANGO (1.0.4)

2012-05-16 Thread Andre Terra
I don't even use IBM databases, but I just wanted to say thank you and great job! I'm always happy to see Django being embraced all across the IT industry and to see IBM developing and maintaining an part of this great framework is always heart warming. Keep up the good work! Cheers, AT On We

Re: import error: no model named .....

2012-05-17 Thread Andre Terra
Everyone, please follow these guidelines before asking other questions: https://code.djangoproject.com/wiki/UsingTheMailingList Cheers, AT On Thu, May 17, 2012 at 4:14 PM, Tanveer Ali Sha wrote: > even am getting *page not found* error > > 1.^notes/ > the current URL,didnt match any of these

Re: Getting Started-Introduction

2012-05-22 Thread Andre Terra
https://docs.djangoproject.com/en/dev/internals/contributing/ On Tue, May 22, 2012 at 11:17 AM, vishrut mehta wrote: > Thank you a lo..! But i tld u im a bit new to all this...Can u > please explain how to solve bugs and submit the patches,means the procedure > ??I am just new to this...

Re: Generic views create_object and prefill form data?

2012-05-23 Thread Andre Terra
For the record, you could go even further (and you may already have), and make the get_initial part of a WebsiteMixin so that you can reuse it in other views without having to repeat yourself. Cheers, AT -- Forwarded message -- From: Paul Date: Wed, May 23, 2012 at 5:09 PM Subje

Re: track change

2012-05-23 Thread Andre Terra
Google for Django Audit Log and/or Audit Trail. While some of the packages might not be under active development, they may be able to point you in the right direction. Cheers, AT -- Sent from my phone, please excuse any typos. -- On May 23, 2012 5:45 PM, "Carsten Jantzen" wrote: > Hi > > I am l

Re: GeoIP install failure, advice needed

2012-05-24 Thread Andre Terra
sudo brew link geoip? Total guess, btw. Cheers, AT On Thu, May 24, 2012 at 6:39 PM, DF wrote: > Several hours of frustration here and looking to see if anyone has any > advice. > > I'm trying to install GeoIP vie Homebrew and receive the following error > just prior to the install finishing: >

Re: Python IDLE

2012-05-28 Thread Andre Terra
For one thing, I don't know of anybody who uses IDLE as their editor for writing complex code like when developing a website with Django. You can always type 'python manage.py runserver' instead of just 'manage.py runserver' to make sure python is the program that's opening your .py file. It seem

Re: OpenSource IDE with debugger capabilities of PyCharm

2012-05-31 Thread Andre Terra
No IDE recommendations, please! There are many threads regarding that, so please search around, OP. As for template debugging, this is currently a limitation in Django itself AFAIK, but efforts are being made to improve the situation. Sincerely, Andre Terra -- Sent from my phone, please excuse

Re: OpenSource IDE with debugger capabilities of PyCharm

2012-06-01 Thread Andre Terra
31, 2012 at 7:55 PM, Russell Keith-Magee < russ...@keith-magee.com> wrote: > On Thu, May 31, 2012 at 6:54 PM, Andre Terra wrote: > > No IDE recommendations, please! > > > > There are many threads regarding that, so please search around, OP. > > > > As for t

Re: about_dajngo

2012-06-06 Thread Andre Terra
You can also use the Google Chart Tools, if you only need low to moderate complexity charts. https://developers.google.com/chart/ Cheers, AT On Wed, Jun 6, 2012 at 4:11 AM, Pierre de LESPINAY wrote: > If you only need to draw HTML charts, I would suggest to use jQPlot > Le 6 juin 2012 09:06, "

Re: Filter by today

2012-06-12 Thread Andre Terra
You're missing result in your queries because your timestamp DateTimeField includes time information (otherwise it would be a DateField). Cheers, AT -- Sent from my phone, please excuse any typos. -- On Jun 12, 2012 7:55 AM, "Simon Pickles" wrote: > Hi, if my model has a timestamp field, > > c

Re: from future url -- argh

2012-06-14 Thread Andre Terra
I was having the same problem, but with the development version (that is, 1.4+, or soon to be 1.5). Just remove the {% load url from future %} because the future is NOW! :O The old {% url %} tag has apparently been deprecated, but I can't find any notes on this change after 2 mins of googling. L

Re: from future url -- argh

2012-06-14 Thread Andre Terra
Ah, here it is: https://docs.djangoproject.com/en/dev/internals/deprecation/#id2 Cheers, AT On Thu, Jun 14, 2012 at 8:54 PM, Andre Terra wrote: > I was having the same problem, but with the development version (that is, > 1.4+, or soon to be 1.5). > > Just remove the {% load url

Re: Hierarchy Model

2012-07-15 Thread Andre Terra
-- Sent from my phone, please excuse any typos. -- On Jul 15, 2012 11:02 AM, "Setiaman Lee" wrote: > Hi, > > I want to implement hierarchy data model which is quite common in > Relational Data Model. > > Let's say I have Employee model which has the relation to the boss which > link to the employ

Re: Hierarchy Model

2012-07-15 Thread Andre Terra
I recommend using django-mptt. I can't link to it cause I'm writing on my phone, but it's easy to find it on Google. Also, your foreign key should target self rather than Employee, IIRC. Cheers, AT -- Sent from my phone, please excuse any typos. -- On Jul 15, 2012 11:02 AM, "Setiaman Lee" wrote

Re: Return SQL calculation within queryset

2012-07-25 Thread Andre Terra
Please read the following bits of documentation: https://docs.djangoproject.com/en/dev/topics/db/sql/#performing-raw-sql-queries https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.extra Cheers, AT On Tue, Jul 24, 2012 at 9:03 PM, jondbaker wrote: > I'v

Re: Best approach to handling different types of Users

2011-08-18 Thread Andre Terra
Until you install some third party app that accesses User.objects.all() and then suddenly nothing works as it's supposed to. You can access the User object from its related UserProfile instance and do everything you say from there instead of breaking the convention. Nobody's stopping you from writ

Re: Work in memory instead of BD, how to?

2011-08-18 Thread Andre Terra
I think a better solution would be to use a store rather than cache (protip: redis) and, if the calculations are lengthy, write a 'publish' function that writes them to the store and let the user choose when to see the changes in the results appear on the website. Additionally, add a 'modified sin

Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-18 Thread Andre Terra
You can't map python processes to users. It's simply not how it works. This is the web on the 21st century, rethink your concepts instead of trying to fit them on to a completely different paradigm. Change is good. Embrace it. Cheers, AT On 8/18/11, michael kapelko wrote: > I think about 50

Re: Best approach to handling different types of Users

2011-08-19 Thread Andre Terra
Alright, do what you will. Whatever floats your boat.. On Fri, Aug 19, 2011 at 5:12 AM, Matt Schinckel wrote: > > On Friday, August 19, 2011 12:07:44 PM UTC+9:30, Andre Terra (airstrike) > wrote: >> >> Until you install some third party app that accesses >> User.obje

Re: Djangonaut is looking for a job

2011-08-19 Thread Andre Terra
http://djangogigs.com/ https://www.djangoproject.com/rss/community/jobs/ 2011/8/19 Eugeny Belykh > hi)) > i think yes,we should keep trying > > > 2011/8/17 枯藤天涯 > >> hello,I am from China。And I am looking a job about python/django .Just >> same as you .Remote (telecommuting) only.Can we find t

Re: Django Development environment

2011-08-23 Thread Andre Terra
Aptana (aka Eclipse/Pydev) for no reason other than hyperlinks in the code Vim/Notepad++ on occasion virtualenv, git, pip, ack (grep on steroids) nginx (proudly compiled from source with custom modules!) ubuntu 10.04 (will only upgrade to LTS releases) or windows xp. All of these tools are multip

Re: can django be used in destop application?

2011-08-23 Thread Andre Terra
Better yet, http://www.riverbankcomputing.co.uk/software/pyqt/download Cheers, AT On Tue, Aug 23, 2011 at 8:59 PM, Sam Walters wrote: > Seriously why bother? > > http://www.wxpython.org/ > > The whole front end of django is too web-centric. So the only thing > that might be of use is if you h

Re: Delegating a async job from a django view

2011-08-25 Thread Andre Terra
Celery is really all you need. IIRC, you'll have to install celery, django-celery, setup a broker backend (which handles the task dispatching), and a result backend (i.e. where you'll get results from your tasks). This means you'll have to run a celery server and quite possibly a separate server

Re: Combining queries? A "join" in Python?

2011-08-30 Thread Andre Terra
FWIW, I'm using django-mptt to help me traverse my tree of self-referencing models, as well as run complex aggregates based on them. http://django-mptt.github.com/django-mptt/index.html Be aware that the API has changed a lot from 0.3 (which is easily found around the web) to 0.5 (which will requ

Re: django setup.py access denies

2011-09-01 Thread Andre Terra
Email 1000 users directly, see when if you get spam or not. If so, email the first 500 again, rinse and repeat, else proceed to the next batch after 12 hours. Aside from the fact that you will be spamming as well, at least it would be for just one time and for the greater good. Cheers, AT On T

Re: How to group models month by month.

2011-09-06 Thread Andre Terra
http://django.me/aggregation Cheers, AT 2011/9/6 Yaşar Arabacı > > I have a model with datetime field. I want to get a table with three > columns as, year, month and number of items in time span. And I also want to > order them from newest to oldest. What I want to get is something like this:

Re: Binding two views to one url?

2011-09-08 Thread Andre Terra
What you need to do is browse the class-based views docs for how to handle forms with them. https://docs.djangoproject.com/en/dev/ref/class-based-views/#formview Instead of switching from DetailView to FormView, you can just try to add some of the mixins that FormView uses. This way you can merge

Re: How do I render a template variable inside a for loop, when the var is a dict and the key is forloop.counter

2011-09-08 Thread Andre Terra
There is an inflexibility indeed, because the template is meant for designers, not programmers. Try {% for key, value in MyList.items %} instead. A hackier solution would be to write your custom template tag like {% get_from_dict foo bar %} to try to get foo[bar]. But in this case you can just us

Re: How do I render a template variable inside a for loop, when the var is a dict and the key is forloop.counter

2011-09-09 Thread Andre Terra
unter", and > MyDict.loop.counter (2 dots) is too much for the template to be > interpreted correctly. > > > On Sep 8, 12:51 pm, Andre Terra wrote: > > There is an inflexibility indeed, because the template is meant for > > designers, not programmers. > > >

Re: Using gedit for django development

2011-09-13 Thread Andre Terra
Incredible! I'll have to take a look at this over the weekend. Have you given any thought to wrapping hyperlinks around modules, classes and functions for easier browsing? This is the #1 (okay, maybe the only) reason I use Aptana. Cheers, AT On Tue, Sep 13, 2011 at 7:33 AM, Thomas Weholt wrote:

Re: setting the database when using a rawqueryset

2011-09-13 Thread Andre Terra
Not exactly what you want, but https://docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom-sql-directly Cheers, AT On Tue, Sep 13, 2011 at 5:51 PM, Robert wrote: > > I have inherited the support of a Django application and am new to the > language so I would appreciate some advice.

Re: setting the database when using a rawqueryset

2011-09-14 Thread Andre Terra
ete rewrite. The alternative is to figure out how to > > do what I think are complex queries (includes subqueries, group by, > > having, sum commands) using the ORM QuerySet. > > > > On Sep 13, 5:01 pm, Andre Terra wrote: > > > > > > > > > No

Re: setting the database when using a rawqueryset

2011-09-14 Thread Andre Terra
And I apologize for not even saying yours, Robert! Yours, André On Wed, Sep 14, 2011 at 9:32 AM, Andre Terra wrote: > Take a look at the aggregation docs at http://django.me/aggregation for > sum, group by, etc. > > > Cheers, > AT > > > On Tue, Sep 13, 201

Re: Class-based views or "Traditional" Views for Django 1.3?

2011-09-14 Thread Andre Terra
OTOH, getting the hang of it can be hard with the current state of the docs and given that they require a completely different mindset when coding views. Cheers, AT On Wed, Sep 14, 2011 at 10:35 AM, Donald Stufft wrote: > Class Based Views let you override and subclass views to modify their >

Re: SCGI error

2011-09-14 Thread Andre Terra
On Wed, Sep 14, 2011 at 6:10 AM, Tom Evans wrote: I'm not entirely experienced with scgi or uWSGI, but I'm almost > certain that neither of them talk HTTP, which is what Firefox uses to > talk to servers. You need to connect your WSGI/SCGI server to a HTTP > server like Apache, lighttpd, Cherokee

Re: Cannot Connect to Server with Postgresql (9.0)

2011-09-15 Thread Andre Terra
Hello, Eric Welcome to Django! * Can you ping the server? * Are you sure about your username and password? Try creating a new login role through PgAdmin and use that instead to see if the error is in the connection or in the authentication process. * Does your pg_hba.conf file have an entry whi

Re: When is a good time to use db_index? Rule of thumb?

2011-09-16 Thread Andre Terra
Wow, great question and even better answers! Amazing help indeed. Thanks everyone, I learned a bunch from this too. Enjoy the weekend! Cheers, AT On Fri, Sep 16, 2011 at 1:52 PM, Micky Hulse wrote: > Thank you Micah, Donald and Doug! I really appreciate the help! :) > > That really helps to c

Re: Calculated value that depends in related models

2011-09-19 Thread Andre Terra
Have you considered using a cache/store backend like redis[1] instead of saving the result to the database? Using this approach, you can write a custom model method for returning the calculation, which can be called manually every time you need the result. The key difference being that this method

Re: Web Designer

2011-09-26 Thread Andre Terra
Please refer to our recent thread with suggestions for development environments. There's enough there already to get anyone started. On the web: https://groups.google.com/forum/#!msg/django-users/ZwVHa0jBRrY/Fq-jCVxrK7AJ Cheers, AT On Mon, Sep 26, 2011 at 1:25 PM, Sushirod wrote: > > Good s

Re: DJango doesn't work with Oracle 11g on Windows 8

2011-09-26 Thread Andre Terra
Windows 8? On Sat, Sep 24, 2011 at 5:27 AM, Benjamin Welton < benjamin.r.wel...@wmich.edu> wrote: > Hey Alec, > > django.core.exceptions.ImproperlyConfigured: Error loading cx_Oracle > module: DLL load failed: %1 is not a valid Win32 application. > > Do you have the visual c redistributable inst

Re: DJango doesn't work with Oracle 11g on Windows 8

2011-09-26 Thread Andre Terra
ows 8 since the developer preview is > available. If he actually is id be curious to know if everything works ok on > windows 8 with python/django. > > Ben > > > On 09/26/2011 04:10 PM, Andre Terra wrote: > > Windows 8? > > On Sat, Sep 24, 2011 at 5:27 AM, Benj

Re: Extracting the database name from an object

2011-09-27 Thread Andre Terra
It doesn't hurt to remind him that methods that begin with _ are considered unstable API and are subject to change/removal without previous notice. Cheers, AT On Tue, Sep 27, 2011 at 3:51 PM, Willem Romijn wrote: > ob._state.db, according to this article: > > > http://stackoverflow.com/questio

Re: psycopg2 pickling error

2011-09-28 Thread Andre Terra
Thanks for providing this feedback, Tom. I read your original question but I wasn't sure of the answer, so it's good to know how you worked it out! Best regards, AT On Wed, Sep 28, 2011 at 4:51 AM, tom wrote: > Hello, > > I have solved the problem with the support from newrelic, the issue was >

Re: Two django apps (models) using same table

2011-09-29 Thread Andre Terra
Perhaps https://docs.djangoproject.com/en/dev/ref/models/options/#db-table ? But you really shouldn't describe the same table twice, if it's exactly the same thing. Move the models.py to a standalone "app" and have your two apps refer to that instead. Cheers, AT On Thu, Sep 29, 2011 at 2:28 PM,

Re: Simple input forms which show more than one row - easy/possible in django?

2011-10-05 Thread Andre Terra
I've only skimmed this thread, but I recommend django-form-utils[1] if what you want is to write nicely formatted forms with little to no headache at all. [1] https://bitbucket.org/carljm/django-form-utils/overview Cheers, AT On Wed, Oct 5, 2011 at 1:05 PM, Chris G wrote: > On Wed, Oct 05, 20

Re: What is the right way to use S3 as a storage backend?

2011-10-05 Thread Andre Terra
I may be dreaming, but IIRC ADMIN_MEDIA_PREFIX is on its way to deprecation, so some googling might be in order. Cheers, AT On Wed, Oct 5, 2011 at 11:07 AM, Kurtis wrote: > Okay, two things. > > 1. I saw I was potentionally using the wrong URL. I believe it should > be my CDN URL. Correct me i

Re: How to make Django pick new urls immediately

2011-10-07 Thread Andre Terra
That is correct. I believe you could go even further and not even prefix the app's urls, by adding an empty path (r'^', include('api.urls')), I don't quite remember what the raw string should look like, but this would let you apply your app's url patterns to the root of your domain, which in some

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

2011-10-07 Thread Andre Terra
The easiest way would be to slice the list exactly how you were doing with x[3]... It doesn't get much easier than that. I guess if you really need to spare yourself three keystrokes, you can do it like this: >>> x = YourModel.objects.all()[3] >>> x.foo = 'bar' >>> x.save() Cheers, AT On Fri,

Re: Profiling Django

2011-10-12 Thread Andre Terra
A good place to start is using django-debug-toolbar and taking a look at the queries generated for each view, so that you know what's taking long. There are tools for monitoring database performance, but I have no experience with them, so I'll leave it to other members in this list to make the reco

Re: Second coming of Java?

2011-10-13 Thread Andre Terra
On Thu, Oct 13, 2011 at 7:04 AM, Petite Abeille wrote: > (...) > > How To Write Unmaintainable Code. > http://thc.org/root/phun/unmaintain.html > > Tangentially related: > > Big Ball of Mud > http://www.laputan.org/mud/ > > I had read Big Ball of Mud before, but "How to Write Unmaintainable Code"

Re: a django question about "python manage.py syncdb"

2011-10-14 Thread Andre Terra
models should be lowercase, because that's the standard for every single python package. Cheers, AT On Fri, Oct 14, 2011 at 6:23 AM, Chen Xu wrote: > Hi, > I am new to Django. > I have installed Django and go t everything set up correctly, just started > some easy tutorials. > > So when I do >

Re: Automaticall list all fields of generic model in template

2011-10-17 Thread Andre Terra
Even better, use django-form-utils! https://bitbucket.org/carljm/django-form-utils/overview Cheers, AT On Sun, Oct 16, 2011 at 7:57 PM, Mario Gudelj wrote: > I think you need this > https://docs.djangoproject.com/en/dev/topics/forms/modelforms/ > > > On 16 October 2011 18:24, bovender wrote:

Re: Class Based FormView - Initial Logic

2011-10-17 Thread Andre Terra
Maybe some place inside get(), dispatch() or get_form_kwargs()? Cheers, AT On Mon, Oct 17, 2011 at 3:57 PM, Kurtis wrote: > Hey, > > I have a FormView and a Form. I want to put in some logic that will > take place before the Form is even displayed. I know I could throw > this in a decorator an

  1   2   3   4   5   >