Re: row = cursor.fetchone() / row = cursor.fetchall()

2012-11-22 Thread Nebros
I saw your answer and it was long and with a lot of time, i thanks for that. I have removed {% block content %} and i did other changes, like you sayed. >>> c.execute("SELECT id, name from auth_group WHERE id < 4") 3L >>> c.fetchall() ((2L, u'Client Super User'), (3L, u'Helpdesk User'), (1L,

Re: Editing model instance

2012-11-22 Thread Sandeep kaur
On Thu, Nov 22, 2012 at 5:32 PM, Sergiy Khohlov wrote: > you can set values in form via form __init__ > Values of some other instance? How? -- Sandeep Kaur E-Mail: mkaurkha...@gmail.com Blog: sandymadaan.wordpress.com -- You received this message because you are

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

2012-11-22 Thread Dae_James
For example, art_time is a date-time type. As we know, {{ art_time|timesince }} return the time since art_time to now. However, I want to know how to judge whether the result is within 24 hours. Shortly, how to know whether art_time is today or the day before today in template layer? -- You

Comment user field

2012-11-22 Thread Lachlan Musicman
It should be obvious, but I can't quite grok how to set the comment user to request.user in the comments/form.html I have a copy of comments/form.html in my templates folder in which I've removed the email and the url fields, but now I want to either set the default and auto fill to the user name

SimpleListFilter not returning expected list

2012-11-22 Thread Lachlan Musicman
Hola, Still with the same code base - now it's rendering, but I'm not getting the results I expect from the filter. A model with an 'island' field that's a choice list. I want to distinguish between one island in particular (Tarawa) and the rest (the Outer Islands). The results I'm expecting

Re: SimpleListFilter is giving "NotImplementedError"

2012-11-22 Thread Lachlan Musicman
On Fri, Nov 23, 2012 at 12:17 PM, Lachlan Musicman wrote: >>> Hola, >>> >>> After successfully implementing two range based filters using the admin's >>> list_filter docs: >>> PATH/ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.list_filter >>> >>> I've added one

Re: SimpleListFilter is giving "NotImplementedError"

2012-11-22 Thread Lachlan Musicman
On Fri, Nov 23, 2012 at 12:06 PM, Tom Evans wrote: > On Thu, Nov 22, 2012 at 11:21 PM, Lachlan Musicman wrote: >> Hola, >> >> After successfully implementing two range based filters using the admin's >> list_filter docs: >>

Re: SimpleListFilter is giving "NotImplementedError"

2012-11-22 Thread Tom Evans
On Thu, Nov 22, 2012 at 11:21 PM, Lachlan Musicman wrote: > Hola, > > After successfully implementing two range based filters using the admin's > list_filter docs: > PATH/ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.list_filter > > I've added one more filter,

Re: Template library not found

2012-11-22 Thread Mario8k
El jueves, 22 de noviembre de 2012 13:18:05 UTC-3, iñigo medina escribió: > > > On Thu, 22 Nov 2012, Mario8k wrote: > > > Hi, > > > > I have a custom templatetag inside an app, and also the app is in > > settings.INSTALLED_APPS. Also, I got an error: > > > > "'contacto_formulario' is not a

SimpleListFilter is giving "NotImplementedError"

2012-11-22 Thread Lachlan Musicman
Hola, After successfully implementing two range based filters using the admin's list_filter docs: PATH/ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.list_filter I've added one more filter, but now I'm getting a NotImplementedError and I can't see what I've done wrong. The model

Re: MySQL Connector/Python Django 1.4

2012-11-22 Thread Fred Stluka
Dilip, I'm not using MySQL Connector/Python . I am using: http://sourceforge.net/projects/mysql-python/ What's the difference? Is one better than the other? What platform? I've installed it on CentOS Linux and on Mac OS X. I can give you

MySQL Connector/Python Django 1.4

2012-11-22 Thread Dilip M
Hi, Have anyone got MySQL Connector/Python (1.0.7) working with Django 1.4? If yes, what the installation procedure and how to get it work? Thanks..Dilip -- You received this message because you are subscribed to the Google Groups "Django

composite primary keys and transaction issue

2012-11-22 Thread imgrey
Since django do not support composite primary keys, I'm forced to use plain SQL queries. I got two databases defined and when I try to use UPDATE or INSERT, it simply do nothing: cursor = connections['foods'].cursor() cursor.execute(sql) I tried transaction.commit()

mod_wsgi using a subpath in combination with a middleware that calls django.core.urlresolvers.resolve is not working

2012-11-22 Thread Jan Murre
Hi, I have the following peculiar problem that is very easy to reproduce. I use a simple middleware the attaches the 'app_name' that is defined in the urlconf to 'request.user' for subsequent use. from django.core.urlresolvers import resolve class ApplicationAwareMiddleware(object):

Re: Error opening file for reading: Permission denied

2012-11-22 Thread Tom Evans
On Thu, Nov 22, 2012 at 11:59 AM, Sbady wrote: > Do not know how it happened, I use ubuntu erection apache2 + mod_python > always can not reproduce css, js, image > > Obviously permissions problem, but I do not understand where the permissions > problem > > > apache2---

Re: need help with postgres installation and set-up for doing tutorials

2012-11-22 Thread Bill Freeman
On Wed, Nov 21, 2012 at 8:58 AM, Luisa Beck wrote: > Thank you for your thoughts! I have a few follow-up questions: > > *The reason that I’m trying to figure out postgres is that I’m helping > some folks with a development project and they’re using postgres. I’m > trying to

Re: Template library not found

2012-11-22 Thread I単igo Medina
On Thu, 22 Nov 2012, Mario8k wrote: Hi, I have a custom templatetag inside an app, and also the app is in settings.INSTALLED_APPS. Also, I got an error: "'contacto_formulario' is not a valid tag library: Template library contacto_formulario not found, tried ... " The funny thing is that

Re: memory leak? Am I taking crazy pills?

2012-11-22 Thread Tom Evans
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 deployed to heroku and is leaking memory at a pretty good > clip. Hitting heroku

Re: row = cursor.fetchone() / row = cursor.fetchall()

2012-11-22 Thread Tom Evans
On Thu, Nov 22, 2012 at 2:27 PM, Nebros wrote: > Hello, i know I have asked this before in another post of me, but no one > answered on it and it was not part of topic... > In fact, I did, but you ignored all my advice, didn't fix the problems I pointed out, and

Re: Understanding virtual environment paths

2012-11-22 Thread Javier Guerra Giraldez
On Thu, Nov 22, 2012 at 10:19 AM, Luisa Beck wrote: > But say I create a virtual environment and install a script that depends on > another script that I haven't included in the virtual environment. That > leads me to an error because the script can't be found in that virtual

Template library not found

2012-11-22 Thread Mario8k
Hi, I have a custom templatetag inside an app, and also the app is in settings.INSTALLED_APPS. Also, I got an error: "'contacto_formulario' is not a valid tag library: Template library contacto_formulario not found, tried ... " The funny thing is that the templatetag works correctly in the

Re: Understanding virtual environment paths

2012-11-22 Thread Luisa Beck
Hi Javier, That's super helpful. Thank you! Just to make sure I'm understanding correctly: You write "there's nothing to block you from accessing anything outside the environment. just the defaults are set up so you have to intentionally do it, not by accident." So in other words, the

memory leak? Am I taking crazy pills?

2012-11-22 Thread Dan Ancona
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, under significant load. Wandered through some

Error opening file for reading: Permission denied

2012-11-22 Thread Sbady
Do not know how it happened, I use ubuntu erection apache2 + mod_python always can not reproduce css, js, image Obviously permissions problem, but I do not understand where the permissions problem apache2--- error.log Error opening file for reading: Permission denied

multiple user profile solution

2012-11-22 Thread Juan Carlos Vargas Valencia
I have spend all yesterday making this run, and I have a solution. I dont know if its the best, but see it and please tel me if there is a mor professional way to do it: first I add in customize my user profile

Re: row = cursor.fetchone() / row = cursor.fetchall()

2012-11-22 Thread Nebros
EDIT: with fetchall the output is a table with a lot of empty lines. just with fetchone the lines are diffrent in count. fetchone: so many filled lines like variables ( name, mail, user,...) fetchall: so many empty lines like values like diffrent users there are... Am Donnerstag, 22. November

Re: Understanding virtual environment paths

2012-11-22 Thread Javier Guerra Giraldez
On Wed, Nov 21, 2012 at 7:30 PM, Luisa Beck wrote: > (I'm imagining the virtual environment like a sandbox around my project. I > can play with the things I put into the sandbox.) So when I place a file > outside of that, can I still access it when my virtual environment is >

row = cursor.fetchone() / row = cursor.fetchall()

2012-11-22 Thread Nebros
Hello, i know I have asked this before in another post of me, but no one answered on it and it was not part of topic... I am using pyodbc and try to give data out into my page... Here the part of pyodbc (and yes this works): views-

Re: Editing model instance

2012-11-22 Thread Sergiy Khohlov
you can set values in form via form __init__ 2012/11/22 Sandeep kaur : > On Thu, Nov 22, 2012 at 4:54 PM, Sergiy Khohlov wrote: >> Have you tried to change instances to your new tables ? >> > If I try instance of new table, I won't get the old

Re: Editing model instance

2012-11-22 Thread Sandeep kaur
On Thu, Nov 22, 2012 at 4:54 PM, Sergiy Khohlov wrote: > Have you tried to change instances to your new tables ? > If I try instance of new table, I won't get the old values that I need to edit. -- Sandeep Kaur E-Mail: mkaurkha...@gmail.com Blog: sandymadaan.wordpress.com

Re: Editing model instance

2012-11-22 Thread Sergiy Khohlov
Have you tried to change instances to your new tables ? 2012/11/22 Sandeep kaur : > I edit value of a table using model instance, however after editing I > want the values to be saved in some other table with same structure. > For this to happen I have used following code

Editing model instance

2012-11-22 Thread Sandeep kaur
I edit value of a table using model instance, however after editing I want the values to be saved in some other table with same structure. For this to happen I have used following code in views.py : def editjob(request): clientjob = ClientJob.objects.get(job_id = query)

Re: DetailView

2012-11-22 Thread Sergiy Khohlov
good news ! pk key is ok , But your database does not contain record for this user. you can do this by manually investigating database or by next code: rom django.core.exceptions import ObjectDoesNotExist try: MyModel = UserModel.objects.get(id=1) except ObjectDoesNotExist:

Re: DetailView

2012-11-22 Thread David
Hi Sergiy That line outputs: 1 -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/p3yEqcw-2_cJ. To post to this group, send email to

Re: DetailView

2012-11-22 Thread Sergiy Khohlov
Could you please add next string before profile = UserModel.objects.filter(pk=self.kwargs['pk']) print self.kwargs['pk'], type(self.kwargs['pk']) I would like to know something 2012/11/22 David : > Sergiy > > Some of your points cover my old code

Re: DetailView

2012-11-22 Thread David
Sergiy Some of your points cover my old code (which was very much a first draft). This is the updated version: class home(DetailView): context_object_name = 'profile' template_name = 'view_profile.html' def get_context_data(self, **kwargs): context = super(home,

Re: Seeding Foreign Key with known object with Class Based Views

2012-11-22 Thread Sergiy Khohlov
https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-display/ switch Publisher to client and books to address :-) 2012/11/22 Lee Hinde : > I have two tables, Client and Address. Address has a foreign key 'client' > which points to the client table. I'll

Re: DetailView

2012-11-22 Thread Sergiy Khohlov
I would like to say that this code is really bad : def get_queryset(self): UserModel = get_user_model() pk = self.kwargs['pk'] if not pk: profile = UserModel.objects.filter(pk=self.request.user) else: profile =