Re: How I do to centralize logins OpenID in django?

2012-08-22 Thread Thomas Orozco
+1 - If you are running both apps using the same database server, this would probably be the simpler solution! Le 22 août 2012 04:26, "Kurtis Mullins" a écrit : > I've never tried this approach; but maybe you could use the multi-database > feature of Django to share a database for the Authenticat

Re: View loaded twice / Database entry saved twice

2012-08-22 Thread Jeff Tchang
Is it possible you are testing using a browser and it is doing a request for the page and for favicon.ico? That would end up being 2 requests. You can use something like Chrome Developer Tools or Firebug to see. -Jeff On Tue, Aug 21, 2012 at 4:07 PM, James Verran wrote: > Hi there, I'm trying t

Re: View loaded twice / Database entry saved twice

2012-08-22 Thread Martin J. Laubach
Also, you should really only do saves on a POST request, never on GETs. mjl -- 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/-/jIUH0iInCQ0J. To post

Re: Can somebody help me on how to handle this scenario?

2012-08-22 Thread Paul Backhouse
You shouldn't need to define "People" or "User", that already comes in django.contrib.auth.models. Just import User and make that your foreign key where needed. A smart way would be to use django.contrib.comments. https://docs.djangoproject.com/en/dev/ref/contrib/comments/ For more complex comm

conditional submit depending on ajax call

2012-08-22 Thread mapapage
Hi!I'm trying to perform an ajax call on the submit of a form. The form will be submitted depending on the call's result. I'm doing sth like that: $("#myform").submit(function() { var rdatefrom=$('#id_rdatefrom').val(); var arr_sdateText = rdatefrom.split("/"); startday = arr_sdateTe

Re: authenticate=None mistery: can't authenticate from the web but it works from the command line

2012-08-22 Thread Tom Evans
In addition to the 'user'/'username' typo, this login view would not log a user in. In order to log a user in, you must verify their credentials by calling django.contrib.auth.authenticate(), which will either return an authenticated user or None. Once the credentials are verified, you must then c

Re: Distinct Values in ModelChoiceField

2012-08-22 Thread Sithembewena Lloyd Dube
@Melvyn, thanks - that makes sense. On Wed, Aug 22, 2012 at 3:18 AM, Melvyn Sopacua wrote: > On 22-8-2012 3:04, Sithembewena Lloyd Dube wrote: > > > I found your response to the OP interesting, yet I cannot quite follow > it. > > Even if he sets a unique attribute (presumably Boolean/ Checkbox?)

GeometryField in OSMGeoAdmin

2012-08-22 Thread geonition
Hi, I have a problem with GeometryField not showing the saved geometry in the admin interface. The problem is that the GeometryField has a type of 'GEOMETRY' when the value saved might have the type of e.g. 'POINT'. This leads to that the OpenLayersWidget will set the value as empty. I do not

Re: conditional submit depending on ajax call

2012-08-22 Thread Tom Evans
Your JS looks decidedly incorrect. You say the aim is to prevent the form being submitted in certain scenarios, yet your form submit handler neither returns true nor false. You return truthiness from your anonymous AJAX handler, but that is not the same. Secondly, your check to see whether to subm

Re: What is the easy way to install DJango?

2012-08-22 Thread Tom Evans
On Wed, Aug 15, 2012 at 3:53 PM, Vibhu Rishi wrote: > Hi, > > If you are new to Django and are just getting around to learn it, I > recommend using BitNami Django stack for windows. > http://bitnami.org/stack/djangostack > > So far, it has been the easiest to install on the windows machine. > > Vi

Re: skip fixtures loading on 'manage.py test myapp'

2012-08-22 Thread Anton Baklanov
exactly On Wed, Aug 22, 2012 at 2:24 AM, Karen Tracey wrote: > That link doesn't really explain why south would be loading fixtures that > Django itself wouldn't ordinarily load. Unless...do you have migrations > that are loading fixtures? > -- Regards, Anton Baklanov -- You received this

Re: How I do to centralize logins OpenID in django?

2012-08-22 Thread Adam
Ok! but if I share the database for the Authentication then will not be required registration for each site. I want a system similar to that used on StackExchange, for each site is required to register but the username doesn't change it is always the same for all sites. Thank you very much! I

Re: How I do to centralize logins OpenID in django?

2012-08-22 Thread Adam
Thank you! Il giorno mercoledì 22 agosto 2012 09:39:43 UTC+2, Thomas Orozco ha scritto: > > +1 - If you are running both apps using the same database server, this > would probably be the simpler solution! > Le 22 août 2012 04:26, "Kurtis Mullins" > > a écrit : > >> I've never tried this approac

Re: conditional submit depending on ajax call

2012-08-22 Thread mapapage
> > I can see what you mean. > Meanwhile, I tried the following and it seems to work: $("#myform").submit(function() { var rdatefrom=$('#id_rdatefrom').val() var arr_sdateText = rdatefrom.split("/"); startday = arr_sdateText[0]; startmonth = arr_sdateText[1]; startyear = arr_

Re: authenticate=None mistery: can't authenticate from the web but it works from the command line

2012-08-22 Thread Jorge Garcia
Indeed it was a typo! Now that I have a valid user instance, I will use django.contrib.auth.login() to have a session. Thank you both for your help ;) Le mercredi 22 août 2012 12:37:42 UTC+2, Tom Evans a écrit : > > In addition to the 'user'/'username' typo, this login view would not > log a

Re: What is the easy way to install DJango?

2012-08-22 Thread Jani Tiainen
22.8.2012 14:56, Tom Evans kirjoitti: On Wed, Aug 15, 2012 at 3:53 PM, Vibhu Rishi wrote: Hi, If you are new to Django and are just getting around to learn it, I recommend using BitNami Django stack for windows. http://bitnami.org/stack/djangostack So far, it has been the easiest to install o

Re: What is the easy way to install DJango?

2012-08-22 Thread Demian Brecht
Er, it's easy to install on Windows until you want to install a package that has C extensions. Then, you're either scouring the web for pre-builts (which can be a pain depending on your architecture and your level of paranoia about the contents of the binaries) or you're installing a GNU toolchain

Re: What is the easy way to install DJango?

2012-08-22 Thread Amyth Arora
Here is an easy tutorial on how you can install django on windows http://techstricks.com/install-django-on-windows-7/ .I am assuming that you already have python installed on your computer, if not then First install Python using this tutorial http://techstricks.com/installing-python-2-7-on-windows-

Re: View loaded twice / Database entry saved twice

2012-08-22 Thread James Verran
Yes, I think you are right! That would explain the strange behaviour - even in the admin section the page is being loaded. Thank you! On Wed, Aug 22, 2012 at 1:10 AM, Jeff Tchang wrote: > Is it possible you are testing using a browser and it is doing a request > for the page and for favicon.ico?

HttpResponseNotModified returning 200 code

2012-08-22 Thread Kevin Anthony
Here is my code: id = get_id(request) if id is not None: host = request.GET['host'] if host!=None: command = command_queue.objects.all().filter(destination_hostname=host,user__id=id) if not command.count(): HttpResponseNotModified()

Re: HttpResponseNotModified returning 200 code

2012-08-22 Thread Alexis Roda
Al 22/08/12 21:36, En/na Kevin Anthony ha escrit: Here is my code: id = get_id(request) if id is not None: host = request.GET['host'] if host!=None: command = command_queue.objects.all().filter(destination_hostname=host,user__id=id) if not co

Re: How to use Django with Apache and mod_wsgi

2012-08-22 Thread Seyfullah Tıkıç
I checked my file again, it is not incomplete. There is no file in /etc/apache2/conf.d Output of apachectl -S is as below. I actually uninstalled mod_python, I want to use mod_wsgi only. Syntax error on line 49 of /etc/apache2/modules.d/16_mod_python.conf: Invalid command 'PythonHandler', perhaps

Re: How to use Django with Apache and mod_wsgi

2012-08-22 Thread Seyfullah Tıkıç
Then do I have to delete 00_default_vhost.conf file? What name can I give to this new created file? 2012/8/20 Joseph Mutumi > You would be good to organize your configuration. Try creating a file > under /etc/apache2/vhosts.d/ > Probably my_domain.com (substitute my_domain.com with your actual d

runserver error: "No module named app3"

2012-08-22 Thread Bill Beal
Hi all, I have a Django project with apps that works OK on a Mac with Django 1.3 and Python 2.6, and I'm trying to move it to a Linux box with Django 1.4 and Python 2.7. I created an empty project 'proj' with apps 'app1', 'app2', 'app3' on the Linux system and carefully merged settings.py, ur

SyntaxError Creating New Project

2012-08-22 Thread Bestrafung
I'm new to Django and though I've dabbled with Linux off and on for a decade I'm still learning so please go easy on me. I'm following this guideto setup a Django 1.4.1 test project. So far I've

Re: I can't start new project

2012-08-22 Thread rafi r
thanks so much this helped me tons!!! On Tuesday, December 27, 2011 9:27:06 AM UTC-5, Andre Terra (airstrike) wrote: > My bet is that you're using Windows. > > Open the Registry Editor (hit Winkey+R, "regedit" (no quotes), hit enter) > > --- > > Go to HKEY_CLASSES_ROOT\Applications\python.exe\sh

custom field for callable python object like class or function

2012-08-22 Thread Michael Palumbo
Hi, Do you know a custom field for a callable python object like a Class or a function ? It could store it as a string in the DB: "module1.module2.class" or "module1.module2.function" With that string, it could load it as a real python object when you get it from the DB. For example, you c

Re: custom field for callable python object like class or function

2012-08-22 Thread Kurtis Mullins
It looks like you want to, basically, store a reference to a Python object in your Model. It shouldn't be too extremely difficult. I'd create a Model for this purpose though and just use extra methods to provide any functionality you need. Just as a quick prototypical example: class ReferenceModel

Re: custom field for callable python object like class or function

2012-08-22 Thread Kurtis Mullins
Whoops, foo = property(get_reference, set_reference) should be reference = property(get_reference, set_reference) Sorry, was reading another page to make sure I have the property code right: http://stackoverflow.com/questions/1454727/do-properties-work-on-django-model-fields On Wed, Aug 22, 20

Re: SyntaxError Creating New Project

2012-08-22 Thread Kurtis Mullins
Very weird. I ran the syntax and did not receive a syntax error. I just checked on the documentation and it does say Python 2.5 is required, which as you mentioned you have installed. Maybe double-check to make sure that you're executing this with the right Python executable? I'm running Python 2.

Re: HttpResponseNotModified returning 200 code

2012-08-22 Thread Kevin Anthony
wow, that's embarrassing. thanks. On Wed, Aug 22, 2012 at 4:16 PM, Alexis Roda < alexis.roda.villalo...@gmail.com> wrote: > Al 22/08/12 21:36, En/na Kevin Anthony ha escrit: > >> Here is my code: >> >> id = get_id(request) >> if id is not None: >> host = request.GET['host'] >>

Re: custom field for callable python object like class or function

2012-08-22 Thread Michael Palumbo
ok thanks, so you'd rather do it with a Model than a custom field. I actually started to make a custom field but I had a few issues while displaying it in the admin so that's why I asked the question then. Le jeudi 23 août 2012 00:16:48 UTC+2, Kurtis a écrit : > > Whoops, > > foo = property(get_

Caching Options

2012-08-22 Thread James
Right now, I'm loading up some data VIA the orm. The nature of the data is fairly complex, somewhere around 10-12 tables are touched per insert and about twice that number referencing static helper tables. For production and day to day use, I've been using django-cache-machine, but I've also be

Re: What is the easy way to install DJango?

2012-08-22 Thread Demian Brecht
> Or installing the M$ VC++ Express edition compatible with the > version used for the Python build > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/ > > Sure (or MinGW if I'm not mistaken) but the que

Re: GeometryField in OSMGeoAdmin

2012-08-22 Thread Melvyn Sopacua
On 22-8-2012 10:31, geonition wrote: > I have a problem with GeometryField not showing the saved geometry in the > admin interface. The problem is that the GeometryField has a type of > 'GEOMETRY' when the value saved might have the type of e.g. 'POINT'. The GeometryField is like the normal Fie

Re: Can somebody help me on how to handle this scenario?

2012-08-22 Thread Melvyn Sopacua
Hi Nirmal, I'll try to answer your question instead of assuming you're working with django's auth system. On 22-8-2012 7:13, Nirmal Sharma wrote: > class People (models.Model): > person_name = models.CharField(max_length=150) > > > class comments (models.Model): > comment = model

Re: SyntaxError Creating New Project

2012-08-22 Thread Alexis Roda
Al 22/08/12 23:00, En/na Bestrafung ha escrit: I'm new to Django and though I've dabbled with Linux off and on for a decade I'm still learning so please go easy on me. I'm following this guide to

Re: SyntaxError Creating New Project

2012-08-22 Thread Karen Tracey
On Wed, Aug 22, 2012 at 5:00 PM, Bestrafung wrote: > I'm new to Django and though I've dabbled with Linux off and on for a > decade I'm still learning so please go easy on me. I'm following this > guide

Re: Caching Options

2012-08-22 Thread Phang Mulianto
Hi i also use johhny cache, why it not hit your cache? Johny cache will cache your queryset and update it when the database table for the queryset updated. I only cache the queryset without add code in the views, johny cache handle the rest Pada 23 Agu 2012 06.46, "James" menulis: > Right now,

Re: django.db.utils.DatabaseError when resyncing django app models

2012-08-22 Thread Mhlanga Bothin
On 22/08/2012, at 1:51 PM, Karen Tracey wrote: > The key part of the traceback is this: > > File > "/usr/local/lib/python2.7/site-packages/django/core/management/sql.py", line > 189, in emit_post_sync_signal > interactive=interactive, db=db) > File > "/usr/local/lib/python2.7/site-pack

Re: django.db.utils.DatabaseError when resyncing django app models

2012-08-22 Thread Melvyn Sopacua
On 23-8-2012 2:37, Mhlanga Bothin wrote: > Thanks a lot for your help. I am not adding any classes to the app on > the second sync, correct me if I am wrong but django only resyncs new > classes? Yes and no. The permissions are a special case, they are also updated if you add permissions to a mod

Re: runserver error: "No module named app3"

2012-08-22 Thread Melvyn Sopacua
Hi Bill, On 22-8-2012 23:16, Bill Beal wrote: Look at it like this to spot your error: > 'proj.app3', > proj/ cwd of the WSGI app > proj/proj/ >settings.py DJANGO_SETTINGS_MODULE = 'proj.settings' > proj/app3/ So this module is not proj.app3 but app3. I'm reasonably sure t

Re: custom field for callable python object like class or function

2012-08-22 Thread Melvyn Sopacua
On 23-8-2012 0:37, Michael Palumbo wrote: > ok thanks, so you'd rather do it with a Model than a custom field. > I actually started to make a custom field but I had a few issues while > displaying it in the admin so that's why I asked the question then. You can pickle an object and store the resu

Layout and global.css files

2012-08-22 Thread Gregory Strydom
Could anyone perhaps tell me where i could find the layout.css and global.css for the base admin site? Ive tried looking through C:/Python26/site-packages/django but cant seem to find anything. What i am trying to do is just change colour where it say Users, Groups, Sites etc in the django admi

Re: Layout and global.css files

2012-08-22 Thread Jeff Tchang
I see some stuff under: /python/lib/python2.6/site-packages/django/contrib/admin/static/admin/css On Wed, Aug 22, 2012 at 6:41 PM, Gregory Strydom < gregory.strydom...@gmail.com> wrote: > Could anyone perhaps tell me where i could find the layout.css and > global.css for the base admin site? >

Re: Layout and global.css files

2012-08-22 Thread Melvyn Sopacua
On 23-8-2012 3:41, Gregory Strydom wrote: > Could anyone perhaps tell me where i could find the layout.css and > global.css for the base admin site? > > Ive tried looking through C:/Python26/site-packages/django but cant seem to > find anything. You shouldn't edit anything there - it will be lo

Re: Layout and global.css files

2012-08-22 Thread Mike Dewhirst
On 23/08/2012 11:41am, Gregory Strydom wrote: Could anyone perhaps tell me where i could find the layout.css and global.css for the base admin site? Ive tried looking through C:/Python26/site-packages/django but cant seem to find anything. What i am trying to do is just change colour where it sa

Re: Layout and global.css files

2012-08-22 Thread Gregory Strydom
Thanks very much for the replies, this really helps alot! -- 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/-/W33sPdspM00J. To post to this group, send email

Re: django.db.utils.DatabaseError when resyncing django app models

2012-08-22 Thread Mhlanga Bothin
On 23/08/2012, at 10:59 AM, Melvyn Sopacua wrote: > On 23-8-2012 2:37, Mhlanga Bothin wrote: > >> Thanks a lot for your help. I am not adding any classes to the app on >> the second sync, correct me if I am wrong but django only resyncs new >> classes? > > Yes and no. The permissions are a spec

Re: runserver error: "No module named app3"

2012-08-22 Thread Bill Beal
Thanks, Melvin! That did it. On to the next error! On Wednesday, August 22, 2012 5:16:15 PM UTC-4, Bill Beal wrote: > > Hi all, > > I have a Django project with apps that works OK on a Mac with Django 1.3 > and Python 2.6, and I'm trying to move it to a Linux box with Django 1.4 > and Python

Re: runserver error: "No module named app3"

2012-08-22 Thread Bill Beal
Sorry, MELVYN. On Wednesday, August 22, 2012 11:53:44 PM UTC-4, Bill Beal wrote: > > Thanks, Melvin! That did it. On to the next error! > > > On Wednesday, August 22, 2012 5:16:15 PM UTC-4, Bill Beal wrote: >> >> Hi all, >> >> I have a Django project with apps that works OK on a Mac with Django

Re: Django + FAPWS doesnt show the templates/view correct

2012-08-22 Thread keeran
I did following changes now., I still see the same observation - I suspect the img folder contents are not taken by webserver for some reason related to template tags not properly linked. any suggestion welcome (otherwise I think i need to go with apache + wsgi) Am referring this link: * htt

database error and connection._rollback

2012-08-22 Thread Mike Dewhirst
This ... [1] from django.db import connection connection._rollback() ... solved a problem for me in unit testing when I catch a deliberate DatabaseError. Django 1.4 Python 2.7 PostgreSQL 9.1 My question: Is it safe enough to use a method with a leading underscore? Is there a better method?

Re: CACHE_MIDDLEWARE_ANONYMOUS_ONLY does not work if user is not printed by view or template

2012-08-22 Thread Bill Freeman
I guess this is probably because the request.user object is created on demand (is a python "property"). The intent, I presume, is to not bother fetching the session, etc., unless it is used, as an optimization. You should find that simply referring to request.user in the view helps. If so, then

Re: From Django 1.1 to Django 1.3.1 - Goes Very Slow

2012-08-22 Thread akaariai
On 21 elo, 19:04, ydjango wrote: > Thank you Paul. I will use those tools. > > I also plan to replace to some ORM queries by raw sql to avoid performance > impact of cloning and multi db enhancements. If you can, please try to pinpoint the reason for regressions, and if it seems to be in Django's

Re: database error and connection._rollback

2012-08-22 Thread akaariai
On 23 elo, 08:30, Mike Dewhirst wrote: > This ... [1] > > from django.db import connection > connection._rollback() > > ... solved a problem for me in unit testing when I catch a deliberate > DatabaseError. > > Django 1.4 > Python 2.7 > PostgreSQL 9.1 > > My question: Is it safe enough to use a me

to_field can not use primary key of related object.

2012-08-22 Thread yillkid
HI all. I write a model: class UserGroup(models.Model): groups = models.ForeignKey(Group, to_field='id') and when I into admin backend: According to the Django document the c