Recommendations for a Django development book?

2009-07-21 Thread Stodge
What is currently the best Django development book? There seem to be quite a few on Amazon.ca, but none are reviewed. I'm familiar with Python and the very basics of Django and I've been developing s/w for 15+ years. So something geared towards advanced users would be good. Much appreciated! Than

Middleware that injects data for template

2009-07-24 Thread Stodge
Say I want to inject a piece of data into every page view. For now, let's just say I want to inject the current time into each page view. I write a piece of middleware that will do it. But how? Do I modify the request? Or the view (process_view)? --~--~-~--~~~---~--~---

Multiple sites, multiple databases, one Django installation? Middleware?

2009-10-30 Thread Stodge
Just wondering whether I could write a middleware that parsed request.path, say: /django/site1/index extracted and removed the site name as "site1" and switched the settings on the fly to use settings_site1.py instead. settings_site1.py would use DB named "site1_db". Then it would process the r

Re: Multiple sites, multiple databases, one Django installation? Middleware?

2009-10-30 Thread Stodge
Sorry, forgot to say that is with mod_python. On Oct 30, 10:48 am, Stodge wrote: > Just wondering whether I could write a middleware that parsed > request.path, say: > > /django/site1/index > > extracted and removed the site name as "site1" and switched the

Re: Multiple sites, multiple databases, one Django installation? Middleware?

2009-10-30 Thread Stodge
DB? On Oct 30, 10:50 am, Stodge wrote: > Sorry, forgot to say that is with mod_python. > > On Oct 30, 10:48 am, Stodge wrote: > > > Just wondering whether I could write a middleware that parsed > > request.path, say: > > > /django/site1/index > > > ext

Re: Multiple sites, multiple databases, one Django installation? Middleware?

2009-10-30 Thread Stodge
I didn't realise there was a "settings" option for syncdb - it works beautifully! I now have multi site with multiple databases and one application installation! Cool... On Oct 30, 11:29 am, Stodge wrote: > Oops - this might be what I need: > > SetEn

URLs created by custom python-markup filter are incorrect

2009-11-19 Thread Stodge
I'm using a custom python-markup filter, which seems to be working well. However, my URLs aren't relative to my site. So if the rendered text before filtering contains: [/login Login] and the login page is at: http://localhost/test/login the filter produces an URL of: http://localhost/login w

@login_required decorator sends me to the wrong URL

2009-11-19 Thread Stodge
I added the @login_required decorator to my view but it redirects me to: http://localhost/accounts/login whereas the URL for my site is: http://localhost/test/accounts/login This is on Apache. Did I forget to configure something in settings.py? Thanks -- You received this message because you

Re: Multiple sites on a single server

2009-11-19 Thread Stodge
I got this working with several sites using Apache. I just created a configuration file for each site and pointed it to different settings files: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE test.settings PythonOption django.

cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Stodge
I'm completely confused. I have a Django environment installed in /var/ www/sites/project, which is accessed using mod_python/Apache. I want to access the Django environment from a script - actually a Mercurial hook. So I added this to my hook: sys.path.append("/var/www/sites") os.

Re: cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Stodge
If I break the code out and write a simple python script that only contains: import sys, os sys.path.append("/var/www/sites") from project import settings from django.core.management import setup_environ setup_environ(settings) Even this doesn't work yet as far as I can tell, it should. Any ideas

Re: cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Stodge
Uh-oh: when did this break? ./manage.py shell Error: Could not import settings 'indigo.settings' (Is it on sys.path? Does it have syntax errors?): No module named settings On Nov 25, 12:21 pm, Stodge wrote: > If I break the code out and write a simple python script that on

Re: cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Stodge
12:56 pm, Bill Freeman wrote: > Does /var/www/sites/project/__init__.py exist? > > Are the files and directories readable, and the directories searchable > (excutable) > by the user as which the webserver runs? > > On Wed, Nov 25, 2009 at 12:21 PM, Stodge wrote: > > If

Re: cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Stodge
ww/sites/project/__init__.py exist? > > Are the files and directories readable, and the directories searchable > (excutable) > by the user as which the webserver runs? > > On Wed, Nov 25, 2009 at 12:21 PM, Stodge wrote: > > If I break the code out and write a simple pyth

Re: cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Stodge
And now it doesn't work again.. what is going on??? On Nov 25, 2:18 pm, Stodge wrote: > I think I have it. I'm developing a Mercurial hook in /var/www/sites/ > project/hg/hooks. If I delete this directory it works. If I recreate > the directory and the hook, it fai

Re: cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Stodge
ing to be imported.  If the breakpoint > is hit, you could "n" your way through the file to see if something is > getting an exception that prevents the import from succeeding, then > back up by moving the set_trace() to just before the failing item, restart, > and "s&qu

Re: cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Stodge
;? > Given all of the trouble you're having, can you verify that it imports > successfully?  The settings module itself should have no immediate > dependencies, unless you've placed a bunch of extra stuff in it. > > On Nov 25, 12:53 pm, Stodge wrote: > > > It fails eve

Re: cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Stodge
x27;t work Thanks for your help. On Nov 25, 3:04 pm, Stodge wrote: > I can successfully start python and import the settings file. My > settings file only imports os. > > On Nov 25, 3:01 pm, Tim Valenta wrote: > > > Well, does it have errors?  If you navigate to the directo

Best UI for letting users select an item from a large selection of records?

2009-11-26 Thread Stodge
I have a Ticket model that has a Requirement foreign key. The problem is, there could be hundreds of requirements. Offering the user a drop down combo box of requirements to choose from isn't the best option. So how would you let the user select one record from a large selection? What UI widget(s)

Re: Best UI for letting users select an item from a large selection of records?

2009-11-26 Thread Stodge
Thanks. No, I'm not talking about the admin interface - sorry I should have made that clear. I'm talking about the front end UI. On Nov 26, 9:11 am, Michel Thadeu Sabchuk wrote: > Hi, > > > I have a Ticket model that has a Requirement foreign key. The problem > > is, there could be hundreds of re

Re: Best UI for letting users select an item from a large selection of records?

2009-11-27 Thread Stodge
Thanks. I have the DataTables plugin working so I can filter my records. Now I just need to work out how to select specific ones from the table and work with them. On Nov 26, 9:31 am, David De La Harpe Golden wrote: > Stodge wrote: > > Offering the user a drop > > down combo box

Re: cannot import name settings - accessing Django environment from external script

2009-12-01 Thread Stodge
Argh! Taking this a step further - I'm now trying to access my Django environment from within a Trac (http://trac.edgewall.org) plugin, but I'm getting a similar issue. This works: sys.path.append("/var/www/sites/indigo/") os.environ['DJANGO_SETTINGS_MODULE'] = 'in

Re: cannot import name settings - accessing Django environment from external script

2009-12-01 Thread Stodge
ctory = setup_environ(settings) from indigo.project.ticket.models import Ticket Gives me "ImportError: No module named project.ticket.models". Hmmm. So it can import the settings before calling setup_environ but the environment isn't unusable afterwards. On Dec 1, 12:51 

Re: cannot import name settings - accessing Django environment from external script

2009-12-01 Thread Stodge
an unprivileged user.  Doesn't seem like it > is necessarily germane to the present topic but perhaps something to > think about. > > Am I wrong? Are there exceptions?  I think I have seen some high > profile websites running application code under /var/www > > Stodge wrote:

Audit trail code - avoid multiple foreign key issues?

2009-12-04 Thread Stodge
I'm playing around with the Audit code here: http://code.djangoproject.com/wiki/AuditTrail The Caveats section mentions: Likewise, it fails when there are multiple ForeignKeys? pointing to the same Model, as it doesn't support / compensate for related_name. Does anyone know if this cave

Re: Audit trail code - avoid multiple foreign key issues?

2009-12-04 Thread Stodge
e definition for 'author'. box.test: Reverse query name for field 'author' clashes with related field 'User.audit_Test_author'. Add a related_name argument to the definition for 'author'. Is it possible to override the related_name attribute at runtime?

Javascript and the 'url' tag?

2009-12-11 Thread Stodge
I'm writing some javascript for my django app and I need to use 'url' to lookup an... url! But I can't see how to do it for urls that require parameters. It works for urls without parameters, otherwise I get syntax errors. Any pointers? I'm searching the groups and Google but nothing jumps out so a

Re: Javascript and the 'url' tag?

2009-12-11 Thread Stodge
window.open(url); } So I know the parameter. I don't understand how to use the DOM like you suggested. On Dec 11, 10:34 am, Tom Evans wrote: > On Fri, Dec 11, 2009 at 3:25 PM, Stodge wrote: > > I'm writing some javascript for my django app and I ne

Multiple Django versions on one server?

2010-05-03 Thread Stodge
We're about to deploy our Django app on our production Redhat cluster using mod_wsgi, earlier than expected. We developed the app using Django 1.2b1 because we wanted the multiple database support. Unfortunately, the cluster uses Django 1.1.x. What are the options for running two versions on Django

Re: Multiple Django versions on one server?

2010-05-03 Thread Stodge
is allowed to run Python scripts. Thanks On May 3, 8:10 am, Daniel Roseman wrote: > On May 3, 1:03 pm, Stodge wrote: > > > We're about to deploy our Django app on our production Redhat cluster > > using mod_wsgi, earlier than expected. We developed the app using >

Inconsistent database results between application and shell

2010-05-31 Thread Stodge
I have a query that filters on four fields: res = MyModel.objects.filter(name=self.name, type=self.type, last_update_time__gte=today,

Re: Inconsistent database results between application and shell

2010-05-31 Thread Stodge
vier Guerra Giraldez wrote: > On Mon, May 31, 2010 at 9:56 AM, Stodge wrote: > > I have a query that filters on four fields: > > >                res = MyModel.objects.filter(name=self.name, > >                            

Re: Inconsistent database results between application and shell

2010-05-31 Thread Stodge
Weird: syslog.syslog("Connections = %s" % str(connection.queries)) gives: May 31 12:18:41 localhost python: Connections = [] On May 31, 12:12 pm, Stodge wrote: > Thanks. The various pieces of data (self.name etc) are 100% correct - > I dumped them all using syslog.

Re: Inconsistent database results between application and shell

2010-05-31 Thread Stodge
I hang my head in shame. I had the name and type reversed in my Ajax call to the view. :( On May 31, 12:19 pm, Stodge wrote: > Weird: > > syslog.syslog("Connections = %s" % str(connection.queries)) > > gives: > > May 31 12:18:41 localhost python: Connections = []

Google maps like app for Django for small area?

2010-06-02 Thread Stodge
Is there a Django app (or SDK/API/technology/etc) that can recreate Google maps for a small area (say 60 square miles) with all maps stored locally on the server? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Google maps like app for Django for small area?

2010-06-03 Thread Stodge
geodjango.org/ > > > > On Thu, Jun 3, 2010 at 11:35 AM, Stodge wrote: > > Is there a Django app (or SDK/API/technology/etc) that can recreate > > Google maps for a small area (say 60 square miles) with all maps > > stored locally on the server? Thanks > > &

Multiple languages question about /jsi18n/

2010-06-04 Thread Stodge
I think I have basic internationalisation working for english and french. I can switch languages and change the page's title accordingly. However, if I visit: /jsi18n/ I see the catalog definition and a few gettext related functions etc. However, these are defaults and the translations in the cat

Re: Multiple languages question about /jsi18n/

2010-06-07 Thread Stodge
orget something? I'm sure I have everything setup, but my catalog is always empty. On Jun 4, 10:49 am, Stodge wrote: > I think I have basic internationalisation working for english and > french. I can switch languages and change the page's title > accordingly. However, if I visit:

Re: Multiple languages question about /jsi18n/

2010-06-07 Thread Stodge
Ok I think I see what's happening. I have js strings defined in project/locale and project/app/locale. jsi18n isn't picking up the project level strings but it is seeing the app strings. This doesn't sound right to me. On Jun 7, 9:06 am, Stodge wrote: > I have the jsi18n view

Javascript string catalogs (jsi18n) - accessing strings in project/locale?

2010-06-08 Thread Stodge
I ran makemessages -d djangojs from my project level directory, and Django automatically generated the .po file in project/locale/. I followed the documentation (and the book The Definitive Guide to Django) but I cannot access these translated strings. The catalog is always empty. My urls contains:

Re: Javascript string catalogs (jsi18n) - accessing strings in project/locale?

2010-06-08 Thread Stodge
I even defined this in settings.py but it still doesn't work: LOCALE_PATHS=( os.path.join(os.path.abspath(os.path.dirname(__file__)), 'locale'), ) On Jun 8, 9:13 am, Stodge wrote: > I ran makemessages -d djangojs from my project level directory, and > Django automa

Running syncdb from an install script in django_project/install

2010-06-11 Thread Stodge
I'm writing an install script that resides in django_project/install and one of things it does, is programmatically run syncdb. My current code for this is correct if I do: cd .. python import os os.environ["DJANGO_SETTINGS_MODULE"]="settings" from django.core.management import call_command call_c

Re: Running syncdb from an install script in django_project/install

2010-06-11 Thread Stodge
> full path to the settings file: > > os.environ['DJANGO_SETTINGS_MODULE'] = > "tests.fixtures.sampledjango.settings" > > Are you installing the application using setuptools? If not and you > can't put it in the site-packages, I'd consider using a virtualenv. > > Euan > &

Re: Running syncdb from an install script in django_project/install

2010-06-11 Thread Stodge
"Is there some .py file in your install directory that matches the name of an app you have listed in installed apps?" I think this was the problem. Thanks!! On Jun 11, 11:37 am, Karen Tracey wrote: > On Fri, Jun 11, 2010 at 9:11 AM, Stodge wrote: > > I'm writing an ins

Re: Multiple languages question about /jsi18n/

2010-07-14 Thread Stodge
to think there are major problems with language support in Django 1.1.2. I'm stuck on 1.1.2 as my app runs on a server I cannot control or upgrade. Thanks On Jun 7, 12:19 pm, Stodge wrote: > Ok I think I see what's happening. I have js strings defined in > project/locale and p

Re: Javascript string catalogs (jsi18n) - accessing strings in project/locale?

2010-07-14 Thread Stodge
; but I didn't have myproject in INSTALLED_APPS. > > So the thing that contains localization strings *must* be ALSO in the > INSTALLED_APPS = [..., 'myproject'] > > On 8 kesä, 16:13, Stodge wrote: > > > > > I ran makemessages -d djangojs from my project level dir

What is djangojs.pot?

2010-07-14 Thread Stodge
I'm getting an error during makemessages: Making project level Javascript strings processing language fr Error: errors happened while running msgmerge msgmerge: input file doesn't contain a header entry with a charset specification If I look in project/locale/fr/LC_MESSAGES I see a file djan

Language code after logout - Django ignores settings.language_code?

2010-08-10 Thread Stodge
I have internationalisation working in 1.1.1. When I logout and get re- directed to the login screen, the language code is always 'en' regardless of settings.language_code. Is this the expected behaviour? I realise I'm using an older version but I have no control over the server. -- You received

Three Django forms in different tabs in one template?

2010-09-13 Thread Stodge
I'm working through a nice little feature for my website that will bring all user editable preferences/profile options together into a single web page using tabs. I have the tabs working and I can display a different Django form on each tab but I'm confused how to tie it all together using a view.

Re: Three Django forms in different tabs in one template?

2010-09-13 Thread Stodge
Ah cunning! Thanks - that's a great idea. On Sep 13, 8:13 am, bruno desthuilliers wrote: > On 13 sep, 13:48, Stodge wrote: > > > I'm working through a nice little feature for my website that will > > bring all user editable preferences/profile options together into

Tying a model to a specific database using the model's meta data?

2010-09-17 Thread Stodge
I have a bunch of models and I want to specify which models (tables) are stored on which PostgreSQL database. I've read the documentation and I know I can use the using() function. I'm just wondering this can't be specified in the model's meta data: class Meta: using = 'db_name' or:

Django app that uploads media files and servers them through a view?

2010-09-30 Thread Stodge
Is anyone aware of a Django app that lets you upload media files (not necessarily in the admin site) but serves them through a view instead of as static files via the web server? I need to control access to the media using permissions. Thanks -- You received this message because you are subscribe

Re: upload_to vs FileSystemStorage

2010-10-04 Thread Stodge
If I do upload_to=os.sep, I get an error: Attempted access to '/test.pdf' denied. It's trying to upload to the root of the drive! settings.DOCUMENT_STORE_PATH is something like /var/www/testproject/ documents file = models.FileField(storage=FileSystemStorage(location=settings.DOCUMENT_STORE_PAT

What's the best way to implement project permissions in a project management app?

2010-10-04 Thread Stodge
What's the best way to implement project permissions in a project management app? Should I just create the concept of membership and have a function is_member on the project model? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: What's the best way to implement project permissions in a project management app?

2010-10-05 Thread Stodge
03 pm, Mike Dewhirst wrote: > On 5/10/2010 11:32am, Stodge wrote: > > >   What's the best way to implement project permissions in a project > > management app? Should I just create the concept of membership and > > have a function is_member on the project model? > >

Re: What's the best way to implement project permissions in a project management app?

2010-10-05 Thread Stodge
give you per-project permissions like you > requested. > > On Oct 5, 5:23 am, Stodge wrote: > > > > > That looks like what I need. Thanks. Though I also need per-project > > permissions; so user 'bob' can access tickets on Project A but not on > &g

Problem with FileField and FileSystemStorage and upload_to

2010-10-06 Thread Stodge
I'm trying to use the FileField with a custom FileSystemStorage class. I have my location and upload_to set: location = /opt/files/ upload_to = mike I want files to upload to /opt/files/mike but the filenames are prefixed in the database with /mike, which I don't want. So based on the docs I chan

Delete the FileField record but keep the file?

2010-10-12 Thread Stodge
Short of creating my own custom FileField class, is there anyway to pass an optional "delete" flag to a custom file system storage? I have a case where I want to delete the FileField record, but not the file. -- You received this message because you are subscribed to the Google Groups "Django us

Re: Delete the FileField record but keep the file?

2010-10-14 Thread Stodge
That's basically all I've done unless I can find a cleaner solution. I copy the files elsewhere, delete the records and then copy the files back. On Oct 13, 2:13?am, Jonathan Barratt wrote: > On 12 ?.?. 2010, at 22:42,Stodgewrote: > > > Short of creating my own custom FileField class, is there an

Multiple database issue v1.2.3 - Django reading the wrong database

2010-10-26 Thread Stodge
I have two PostgreSQL (postgresql_psycopg2) databases defined in my settings; default and scenes. If I perform a filter using the 'scenes' DB I get the expected results: Scene.objects.filter(name__contains='ME').using('scenes') [, ] If I perform a get(), Django seems to get completely confused a

Re: Multiple database issue v1.2.3 - Django reading the wrong database

2010-10-26 Thread Stodge
6/site-packages/django/db/backends/ postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) DatabaseError: relation "scene" does not exist LINE 1: ...le", "scene"."datasets", "scene"."transform" FROM "

SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?

2010-12-10 Thread Stodge
I have SESSION_EXPIRE_AT_BROWSER_CLOSE set to True in my settings. When the user visits my custom login page a new session is created for them in the database. The expiry time is set to two weeks. If I then close the browser, the expiry hour/minute are adjusted but it's still set to two weeks in t

Re: SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?

2010-12-10 Thread Stodge
Ok thanks. I'm trying to limit the number of concurrent users using sessions. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to djan

Limit number of concurrent non-admin/non-superuser users

2010-12-10 Thread Stodge
I'm trying to limit the number of concurrent users attached to my Django website. For example I need to implement a floating license system. I've seen a few snippets but so far I think they all implement a middleware. I'm trying to avoid using a middleware because I don't want the overhead on every

Custom template tag for a chaptered document?

2009-12-29 Thread Stodge
I need to write a custom tag. I have a hierarchy of objects that I want to turn into a chaptered document. But I want to be able to build and display the document in a template AND generate a PDF or other format from a view. Can I write a custom template tag and use it in a template and from a view

Filtering for null date times?

2010-01-05 Thread Stodge
Some of my objects have optional datetime fields and in one particular case I want to select only those objects with no datetime set. But how do I do this? I can't see anything in the docs. Any suggestions appreciated. Thanks -- You received this message because you are subscribed to the Google G

Historical Records from "Pro Django" - not working with multiple foreign keys?

2010-01-05 Thread Stodge
I'm trying to use the Historical Records feature from Marty Alchin's "Pro Django" book, but it's not working for me when my model has two foreign keys to users. I'm getting Accessor for field 'owner' clashes with related field Add a related_name argument to the definition for 'owner'. etc It

Re: Historical Records from "Pro Django" - not working with multiple foreign keys?

2010-01-05 Thread Stodge
Kay wrote: > On 10-01-05 11:54 AM, Stodge wrote: > > > I'm trying to use the Historical Records feature from Marty Alchin's > > "Pro Django" book, but it's not working for me when my model has two > > foreign keys to users. I'm getting > &g

Re: Historical Records from "Pro Django" - not working with multiple foreign keys?

2010-01-05 Thread Stodge
Yeah - I just realised there's a group specifically for django- reversion so I requested to join the group. Thanks On Jan 5, 3:09 pm, Andy McKay wrote: > On 10-01-05 12:00 PM, Stodge wrote: > > > Does a Revision instance represent a snapshot of the database or the > > s

Can I wrap the "extends" tag in an "if" tag?

2010-01-20 Thread Stodge
Can I wrap the "extends" tag in an "if" tag? I tried it but I get: Invalid block tag: 'endif' {% if show_header %} {% extends "base.html" %} {% endif %} Is there another way of doing this? I want my view to control whether the header is displayed or not. Thanks -- You received this m

Any performance issues with including templates within other templates?

2010-01-26 Thread Stodge
Quick template performance question. I have two templates for each model; view_object.html and render_object.html. The view template renders the object and extends the base.html template, which renders the menu, includes the CSS and JS. The render_object.html template is used by a view to render a

Project based permissions - best way to implement?

2010-01-28 Thread Stodge
I'm prototyping ideas for a project management tool. It supports multiple projects per site, but I'm not sure how to define permissions on a per project basis. Currently I have: class Project(models.Model): title = models.CharField(max_length=128) description = models.TextField()

Re: News about Geraldo Reports

2010-01-28 Thread Stodge
I can't visit your site from work anyway: Reason/Raison: The Websense category "Potentially Damaging Content" is filtered. :P On Jan 26, 3:42 am, Marinho Brandao wrote: > Hello people, > > I have good news :) > > I've done today the new website of Geraldo Reports [1]. > > Geraldo is a tool to

Re: Project based permissions - best way to implement?

2010-01-28 Thread Stodge
an 28, 1:15 pm, Stodge wrote: > I'm prototyping ideas for a project management tool. It supports > multiple projects per site, but I'm not sure how to define permissions > on a per project basis. Currently I have: > > class Project(models.Model): > >         tit

Re: manytomany relations

2010-01-29 Thread Stodge
I think he needs to read the tutorial: http://docs.djangoproject.com/en/1.1/intro/tutorial03/#write-views-that-actually-do-something And I quote: "Here's one stab at the index() view, which displays the latest 5 poll questions in the system" On Jan 29, 4:57 am, Wayne Koorts wrote: > What d

Re: Project based permissions - best way to implement?

2010-02-02 Thread Stodge
I'm providing my own functions for determining permissions, so I store the user, a permission and a project. I'll have to keep admins away from the permissions page as that'll bypass project based permissions. On Jan 28, 2:53 pm, Stodge wrote: > I thought there might be a way

Re: Multi-table Inheritance and Admin

2010-02-16 Thread Stodge
If you want tags, use the django-tagging application. On Feb 16, 6:36 am, Alper KANAT wrote: > Hey There, > > I've two models: > Entryand > Tag . I think Tag > model as a generic mo

Admin login with RemoteUserMiddleware?

2010-02-18 Thread Stodge
I have the RemoteUserMiddleware middleware working so users are authenticated on a Django site using Apache's basic authentication. However, the admin cannot log in. I only found one post on these groups with the same problem but no answer. So is this possible? Can an admin login somehow when the s

How to debug a 500 error - view not called, request not accessible

2010-03-16 Thread Stodge
I'm using the development server and seeing a POST request that results in a 500 error: [16/Mar/2010 10:10:51] "POST /mysite HTTP/1.1" 500 56458 I'm not getting any errors logged or tracebacks. The request isn't reaching my view even though my urls.py is correct and the app is enabled in settings

Re: How to debug a 500 error - view not called, request not accessible

2010-03-16 Thread Stodge
; > Is it on the test server or on the prodution server? > > Is DEBUG on? > > If debug is off and 500 is beeing showed when maybe django is trying > to find "500.html" and if it's not available when this error happen > like you have. > > On Mar 16, 4:22 pm, Sto

Free Django application hosting?

2007-08-24 Thread Stodge
I'm developing a couple of ideas and I need other people's input. The applications are currently on my development PC at home. Are there any sites that offer free Django application hosting (not source)? The apps would have user accounts so only people I give access to can access them - everyone e

Any way to re-synch database when I change models.py without deleting the DB?

2007-08-24 Thread Stodge
While prototyping my models.py, I often have tweak it to try different ideas out. This means I have to wipe the whole database and rerun manage syncdb - and I have to re-enter the admin information. Is there an easy way to re-synch the database without wiping it so it can somehow apply the SQL ch

Re: Free Django application hosting?

2007-08-24 Thread Stodge
Thanks - I took a look, but it's French so it'll take me a while to see what they offer and how to us them. On Aug 24, 10:44 am, Amirouche <[EMAIL PROTECTED]> wrote: > On Aug 24, 3:49 pm, Stodge <[EMAIL PROTECTED]> wrote: > > > I'm developing a couple o

Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
I'm trying to reference MEDIA_ROOT in my template but it's blank. I have MEDIA_ROOT defined in settings.py: MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'static') I have the correct context processor: TEMPLATE_CONTEXT_PROCESSOR = ( 'django.core.context_processors.i18

Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
Oh that's surprising; the media context processor only creates MEDIA_URL. On Mar 22, 7:11 am, Stodge wrote: > I'm trying to reference MEDIA_ROOT in my template but it's blank. I > have MEDIA_ROOT defined in settings.py: > > MEDIA_ROOT = os.path.join(os.path.abspa

Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
No I need MEDIA_ROOT, I want to experiment with: Thanks On Mar 22, 7:22 am, kenneth gonsalves wrote: > On Thu, 2012-03-22 at 05:11 -0700, Stodge wrote: > > In my template: > > > MEDIA_ROOT: {{MEDIA_ROOT}} > > > But all I see is: > > > MEDIA_ROOT: > >

Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
All good points thanks. I'm only experimenting and learning so this won't hit production. Point taken though. :) On Mar 22, 7:30 am, Tom Evans wrote: > On Thu, Mar 22, 2012 at 12:25 PM, Stodge wrote: > > No I need MEDIA_ROOT, I want to experiment with: > > > >

call_command('syncdb') in virtualenv failing: Error: No module named staticfiles

2012-04-23 Thread Stodge
I'm trying to port an existing app to Django 1.4 so I'm using virtualenv. ./manage.py syncdb works but my old script that calls syncdb and creates dummy data doesn't. My code: os.environ["DJANGO_SETTINGS_MODULE"]="settings" call_command('syncdb', interactive=False) is giving: Error: No module

Re: call_command('syncdb') in virtualenv failing: Error: No module named staticfiles

2012-04-23 Thread Stodge
Bah - I completely forgot that my gen.py script had this : #!/usr/bin/python On Monday, 23 April 2012 07:26:55 UTC-5, Stodge wrote: > > I'm trying to port an existing app to Django 1.4 so I'm using virtualenv. > ./manage.py syncdb works but my old script that calls syncdb a

Do I create an instance of my custom AdminSite in every admin.py?

2012-09-06 Thread Stodge
I'm experimenting with creating a custom admin site but I'm confused about something. Do I create an instance of my admin site in every admin.py or do I only create a single instance somewhere, and if so, where? Thanks -- You received this message because you are subscribed to the Google Group

How to make my custom AdminSite class use my custom login/logout views?

2012-09-06 Thread Stodge
I have a custom AdminSite class working but now I'm trying to work out the best way to make it use my custom login and logout views. I supposed I could copy chunks of code from Django's admin sites.py and make it use my views. But this is a hack. Is there a standard way of using custom login/lo

Permissions and the sites framework

2012-11-04 Thread Stodge
Are there any plans to change the Permissions to use the sites framework? To support multi-site on my site, I need the ability to assign different permissions to the same user on different sites. Alternatively, any suggestions how to achieve this? Thanks -- You received this message because yo

Location of non-app-specific static files?

2012-11-04 Thread Stodge
I have two project static directories, STATIC and STATIC_FILES. STATIC contains non-app specific static files. STATIC_FILES is where static files are "collected". -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the w

Duplicate translation strings in project/app1/locale and project/locale

2011-12-16 Thread Stodge
I'm reworking my translations, but I'm having a problem with duplicate strings. I'm running make messages in the project directory and also in each applications's directory, I'm seeing strings used in an application (found in project/app1/locale) duplicated in project/ locale. This seems counter in

Logging into CSRF protected Django site using Curl?

2012-01-08 Thread Stodge
I want to log in to my Django app using something like curl. I know that I could send a GET to get the login form and the CSRF token and then submit a POST with the username, password and CSRF token. But this seems awfully convoluted. Is this the only to login to a Django site that uses CSRF protec

Re: Authentication over JSON

2012-01-08 Thread Stodge
This link is giving me a Page Not Found. On Jan 7, 1:10 pm, Michael Elkins wrote: > On Sat, Jan 07, 2012 at 11:52:26AM -0500, Kevin Anthony wrote: > >I have a small exposed json API, currently it doesn't require > >authentication, but i'd like to integrate it with django's authentication. > > A q

Re: Logging into CSRF protected Django site using Curl?

2012-01-08 Thread Stodge
Thanks, appreciate it. On Jan 8, 12:16 pm, creecode wrote: > Hello Stodge, > > It seems a bit convoluted on the command line but in reallity not much more > convoluted if you consider all that a browser does for us in this regard. > :-) > > I've used a similar techniq

Django pub/sub with filtering?

2012-01-09 Thread Stodge
I'm trying to design a pub/sub event system for my site. The inputs will be Django signals (e.g. User logged in), views and external POST requests. I can easily create subscriptions: Event type, e.g. Auth.login Instance, e.g. User object for Fred Data, nothing for this example User, subscribing us

One To One relationship with a generic relation?

2012-01-14 Thread Stodge
I've used generic relations and they worked, but in one particular case I need a one-to-one generic relation. Is this possible? -- 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@googlegroups.com. T

Any way to not create default Django permissions?

2012-01-18 Thread Stodge
I have a particular use case where the default permissions don't work for me. I know I can create a custom auth backend, but if I do that, is there a clean, legal way to not create the default model permissions? Thanks -- You received this message because you are subscribed to the Google Groups

  1   2   >