Re: count resulting rows in sliced valuesqueryset

2012-11-23 Thread Peter of the Norse
On Nov 21, 2012, at 3:53 AM, ?manu* wrote: > Suppose I have a queryset qs. For paginating purposes I need to do something > like: > > count = qs.count() > qs = qs[0:100] > > Unfortunately this executes the query twice, which I don't want. Are you sure? This is such a common pattern that I sus

Re: Re: How can I contrast two date-time type variables in template layer?

2012-11-23 Thread Dae James
Soga. Thank you very much. Dae James From: smcoll Date: 2012-11-24 02:02 To: django-users Subject: Re: How can I contrast two date-time type variables in template layer? The 'timesince' filter (based on django.utils.timesince) doesn't return a datetime.timedelta object, but a formatted string

Re: Django 1.6.0 over python 3: mysql?

2012-11-23 Thread Russell Keith-Magee
Hi, The short answer is that MySQLdb is outside the control of the Django project. Django itself is now Python 3 compatible. The compatibility of other libraries is up to their respective maintainers. That said, I doubt you'll regret the move to PostgreSQL :-) Yours, Russ Magee %-) On Sat, Nov

Announce Short URL Generator [short_url]

2012-11-23 Thread Alir3z4
Hello, I've released an python package that is a Short URL Generator. I thought would be useful for other people to use it with django or any other related topic. It's available on github[1], pypi[2]. [1]: http://alir3z4.github.com/short_url [2]: http://pypi.python.org/pypi/short_url Regards,

Re: Invalid properties don't throw errors?

2012-11-23 Thread Tim Chase
On 11/23/12 15:31, Aaron C. de Bruyn wrote: > Python 2.7.3 (default, Aug 1 2012, 05:14:39) > [GCC 4.6.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > (InteractiveConsole) u = User.objects.get(pk=1) u.user = 'test' > > No error. It should be

Re: Django 1.6.0 over python 3: mysql?

2012-11-23 Thread ajendrex
I decided to use postgresql and move on :) On Friday, November 23, 2012 11:02:10 AM UTC-3, ajendrex wrote: > > Hello, > > I'm new to django and I'm going directly to use it over python 3 (I have > been using python 3 for mor than one year). However, the MySQLdb library > doesn't support python 3

Invalid properties don't throw errors?

2012-11-23 Thread Aaron C. de Bruyn
I'm stumped. I have a Django project that's fairly far along--I'm able to use it internally. A few days ago while trying to debug a function, I noticed I was settings a property incorrectly. Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits

Re: memory leak? Am I taking crazy pills?

2012-11-23 Thread akaariai
On 22 marras, 08:27, Dan Ancona wrote: > python 2.7.3, django 1.4.2 > > Our app (a fairly simple tastypie API that runs some machine learning foo on > mongodb records) is deployed to heroku and is leaking memory at a pretty good > clip. Hitting heroku memory errors after about an hour or two,

Re: Email notifications app

2012-11-23 Thread Brad Pitcher
Checkout django drip: https://github.com/zapier/django-drip On Nov 23, 2012 7:22 AM, "Arnaud BRETON" wrote: > Hi everybody, > > I'm looking for a powerful third-app for Django to manage time-driven > email notifications. > > I found django-notifications ( > https://github.com/jtauber/django-notif

Re: Editing model instance

2012-11-23 Thread Sandeep kaur
On Fri, Nov 23, 2012 at 7:25 PM, Victor Rocha wrote: > For starters, I see more than one thing wrong with your code. I hope thats > not the one your actually using and it was just a typo when you asked the > question. > + jform = editJobForm(request.POST, instance=job) # job has not being > define

Questions about unicode

2012-11-23 Thread Santiago Basulto
Hey guys, i'm kind of confused here... If I get data from a request, say: request.GET.get("something") or request.POST.get("something") Is it automatically being encoded based on the Encoding of the request? Or I should take care of it explicitly? Thank you. -- Santiago Basulto.- -- You rece

Re: How can I contrast two date-time type variables in template layer?

2012-11-23 Thread smcoll
The 'timesince' filter (based on django.utils.timesince) doesn't return a datetime.timedelta object, but a formatted string. So it would be hard to compare the resulting string with anything. i think you're going to need to do one of the following: - do the comparison in your view and add

having some validation logic in abstract class

2012-11-23 Thread Emmanuel Jannetti
Hi all, The question is how to add some validation statement in an upper/abstract class against all instances of subclasses. here is the model *class UpperAbstract(models.Model):* * * * def verifyUnique(value):* *if value:* * len(UpperAbstract.objects.filter(myuniquefield=value)) > 0

overwrite field value in subclasses

2012-11-23 Thread Emmanuel Jannetti
Hi all, One piece of my model is as follow : *class UpperAbstract(models.Model):* * CHOICE_A = 0* * CHOICE_B = 1* * **CHOICE_C = 2* * myfield = models.PositiveSmallIntegerField(choices=((CHOICE_A,'A'),(CHOICE_B,"B")** ,(CHOICE_C,"C")**),blank=False)* * class Meta:* * abstract = True* * * *c

Email notifications app

2012-11-23 Thread Arnaud BRETON
Hi everybody, I'm looking for a powerful third-app for Django to manage time-driven email notifications. I found django-notifications (https://github.com/jtauber/django-notification) but it seems not maintained anymore.. Thanks ! -- You received this message because you are subscribed to th

Re: memory leak? Am I taking crazy pills?

2012-11-23 Thread Dan Ancona
Sorry, forgot to mention. Debug is definitely set to False! On Nov 22, 2012, at 7:44 AM, Tom Evans wrote: > On Thu, Nov 22, 2012 at 6:27 AM, Dan Ancona wrote: >> python 2.7.3, django 1.4.2 >> >> Our app (a fairly simple tastypie API that runs some machine learning foo on >> mongodb records) is

Django 1.6.0 over python 3: mysql?

2012-11-23 Thread ajendrex
Hello, I'm new to django and I'm going directly to use it over python 3 (I have been using python 3 for mor than one year). However, the MySQLdb library doesn't support python 3 yet. Is there a way of connecting django to mysql over python3? If not, any plan to get it in the near future? -- Y

Re: Django 1.4: TypeError: get_db_prep_value() got an unexpected keyword argument 'connection'

2012-11-23 Thread Felix Guo
I also have this problem, I don't have any custom field and still see this error. I have completely remove all previous django, but after I install latest django 1.4.2, I can still find your function: get_db_prep_save appeared in /usr/local/lib/python2.7/dist-packages/django/db/models/sql/com

building database

2012-11-23 Thread garlicdud
Hello everyone, in 2006 I created an application with VBA (access from microsoft). I do life access but I can't dig windows. So I switched to linux and I love it. I want to move with it in the same direction and learn to develop database infrastructure. is-there an open source program similar t

Re: Editing model instance

2012-11-23 Thread Victor Rocha
This would be the code I would like you to try: def editjob(request): clientjob = ClientEditJob.objects.get(job_id =query) #adjust query as needed job = EditJob.objects.get(job_id=query)#adjust query as needed if request.method == "POST":

Re: Editing model instance

2012-11-23 Thread Victor Rocha
For starters, I see more than one thing wrong with your code. I hope thats not the one your actually using and it was just a typo when you asked the question. + jform = editJobForm(request.POST, instance=job) # job has not being defined. Also when you instantiate your form, you want to use and i