Moving the .py(c|o) files out of the app?

2009-09-26 Thread Christophe Pettus
This is more a deployment question, but: Is there a way of specifying a directory other than the app folder hierarchy for the .pyc or .pyo files to be written to? In production, I'm not wild about the idea of the app folders being writable by the Apache process. Any guidance? Thanks?

Re: Custom Command as cron

2009-09-26 Thread Fangzx
Hi, I used ubuntu crontab to exec python script in my project. 1. In crontab, you can do like this: DJANGO_SETTINGS_MODULE=divo3.settings PYTHONPATH=/root/deploy # m h dom mon dow command 50 * * * * python /root/deploy/divo3/job.py 2. The job.py file must put in the root dir of django proj

Re: Authentication for static files

2009-09-26 Thread Graham Dumpleton
On Sep 27, 3:08 am, Ben Davis wrote: > I would like to be able to serve files that were uploaded via the admin > site;  for example, when someone clicks on the "Currently:" file link in the > changeform.  However, I also have the following requirements: > >    1. The file should only be accessi

Re: IGNORABLE_404 woes

2009-09-26 Thread Graham Dumpleton
On Sep 27, 1:15 am, troyhitch wrote: > Hi everyone - > > I have deployed two django sites on the same server, with identical > configs (apache, mod_wsgi) and have added this to each of their > settings.py: > > IGNORABLE_404_STARTS = ('/cgi-bin/',) > IGNORABLE_404_ENDS = ('favicon.ico','.php','r

Re: django-trunk/django directory problem

2009-09-26 Thread Malcolm MacKinnon
Thanks, but I don't understand. Will removal cause problems with django project/app on python path. It's simlinked to the python site-packages. On Sat, Sep 26, 2009 at 4:45 PM, Vitaly Babiy wrote: > You have a simlink to the django directory. Just remove the django file. > Vitaly Babiy > > > > O

Re: IGNORABLE_404 woes

2009-09-26 Thread troyhitch
I think I may have figured out what was happening. I did not have a 404.html in templates, and assume now that the messages were coming only because of that (the missing template seemed consequential to me and not the primary cause). I didn't think a template was necessary. Can someone confirm tha

Re: How to customize field to get the correct python value?

2009-09-26 Thread Jay
hi all, I paste the snippet on DjangoSnippet now, and you can see what I meant via http://www.djangosnippets.org/snippets/1741/. This code is perfect if I get the money type from a full-fetched model instance, but the raw integer representation will be shown when trying aggregation or partly fetc

rendering a table

2009-09-26 Thread jhugo
Hi, I want to render a table using a list of list. What I do is create a list for the rows and append another list for the columns. I use two fors in my template to render the table and as the first loop progress the second always renders the values from the beginning and a i end up having my row

Re: django-trunk/django directory problem

2009-09-26 Thread Malcolm MacKinnon
Sure, here it is: malc...@baglux:~/django-trunk/django$ ls -al total 80 drwxr-xr-x 18 malcolm malcolm 4096 2009-08-06 20:16 . drwxr-xr-x 9 malcolm malcolm 4096 2009-08-06 20:16 .. drwxr-xr-x 4 malcolm malcolm 4096 2009-04-30 04:47 bin drwxr-xr-x 7 malcolm malcolm 4096 2009-05-27 08:27 conf drwx

Re: django-trunk/django directory problem

2009-09-26 Thread Vitaly Babiy
You have a simlink to the django directory. Just remove the django file. Vitaly Babiy On Sat, Sep 26, 2009 at 7:42 PM, Malcolm MacKinnon wrote: > Sure, here it is: > > malc...@baglux:~/django-trunk/django$ ls -al > total 80 > drwxr-xr-x 18 malcolm malcolm 4096 2009-08-06 20:16 . > drwxr-xr-x 9

Re: Need help with a filter in a view

2009-09-26 Thread jeffself
Thanks Jim. I'll give this a shot. On Sep 25, 8:24 pm, Jim McGaw wrote: > What you might be asking for is the following syntax, that allows you > to perform queries against the data in more than one table: > > CurrentRanking.objects.filter > (school__schoolseason__league__league_name="League Na

Re: Need help with a filter in a view

2009-09-26 Thread jeffself
Derek, I actually had done my model the way you suggested, but changed my mind. I guess I should listen to my first instinct! Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: django-trunk/django directory problem

2009-09-26 Thread Vitaly Babiy
Post the result of a ls -al in the django dir Vitaly Babiy On Sat, Sep 26, 2009 at 7:16 PM, Malcolm MacKinnon wrote: > About 8 moinths ago, I downloaded the development version of django and > have been using it to develope a web site. I'm using Ubuntu, and I'm not a > skilled programmer, and pe

django-trunk/django directory problem

2009-09-26 Thread Malcolm MacKinnon
About 8 moinths ago, I downloaded the development version of django and have been using it to develope a web site. I'm using Ubuntu, and I'm not a skilled programmer, and perhaps this was caused by something I did, but it appears I don't have subversion installed correctly, as the django directory

Re: Firefox search plugin for Django documents

2009-09-26 Thread Jaú
Nice tip!!! :-D 2009/9/26 Alex Robbins : > > Very nice. I just found out you can assign a keyword to search engines > in the manage search engines menu. Now I just type "django search > term" in the location bar and I get what I need. Don't have to change > the search engine back and forth. > >

Re: IGNORABLE_404 woes

2009-09-26 Thread Karen Tracey
On Sat, Sep 26, 2009 at 4:41 PM, troyhitch wrote: > > Michael - > > Thanks. Unfortunately this doesn't seem to have solved the problem. I > updated settings.py on the culprit site with this: > > IGNORABLE_404_STARTS = ('/cgi-bin/',) > IGNORABLE_404_ENDS = > ('favicon.ico','favicon.ico/','.php','.

Re: IGNORABLE_404 woes

2009-09-26 Thread troyhitch
Michael - Thanks. Unfortunately this doesn't seem to have solved the problem. I updated settings.py on the culprit site with this: IGNORABLE_404_STARTS = ('/cgi-bin/',) IGNORABLE_404_ENDS = ('favicon.ico','favicon.ico/','.php','.php/','robots.txt','robots.txt/') But continue to see the same 404

Modeling and validating international addresses?

2009-09-26 Thread ringemup
I can't be the only person building an app that needs to be able to take mailing addresses from people all over the world, not just in one country. How have you handled models and validation for international addresses? --~--~-~--~~~---~--~~ You received this messa

Re: How to establish foreign key contraints across models living in different applications

2009-09-26 Thread djfis...@gmail.com
Guillermo, It is possible to have a model in one application have a foreign key to another application as of Django 1.0. From: http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey --- To refer to models defined in another application, you can explic

How to establish foreign key contraints across models living in different applications

2009-09-26 Thread Guillermo
Hi all, I have one app with a Project model and another app with a TodoItem model. How can I declare Project to be the foreign key of TodoItem? Or, rather, how can I make TodoItem accept an arbitrary model as foreign key? Regards, Guillermo --~--~-~--~~~---~--~

Re: Composite Key Issue

2009-09-26 Thread Karen Tracey
On Sat, Sep 26, 2009 at 10:41 AM, Robb Bossley wrote: > Thanks again, Karen - you rock! > > Does it automagically do this, or do I need to enter a rule (in views, > perhaps) to check it during validation? I mean, I now have "if > form.is_valid" (though I don't recall if I had that originally). >

Re: Retrieving the request URI inside the view function?

2009-09-26 Thread Alex Robbins
> 1. Consider the user requesting a page like '/orders/9123'.  We detect   > that the user needs to be logged in to see a particular order, so we   > redirect to a login form, saving the '/orders/9123'.  If the user logs   > in as the correct user, we then issue a redirect back to '/orders/9123'.

Passing parent with multiple childs from View to HTML

2009-09-26 Thread PlanetUnknown
I have been studying the modalforms & inline formsets but am not able to wrap my head around my composite objects, and want to see how things are done in django world - I have this hierarchical model "Author" has many "Books" Each "Book" has 4 Sections -> Section-01, Section-02, Section-03 & Se

Re: Firefox search plugin for Django documents

2009-09-26 Thread Alex Robbins
Very nice. I just found out you can assign a keyword to search engines in the manage search engines menu. Now I just type "django search term" in the location bar and I get what I need. Don't have to change the search engine back and forth. Thanks for the awesome plugin. On Sep 24, 4:01 am, 玉东

Re: Composite Key Issue

2009-09-26 Thread Robb Bossley
Karen, When I had tried previously, it seemed that Django would not ensure that the four fields coupled together would be unique - I believe I tried it - and that is why I switched things around. Thank you for the response - I'll have to re-add the id column. On Sat, Sep 26, 2009 at 9:34 AM, Kar

en vs. en_US (was 'Problems creating a new locale')

2009-09-26 Thread Michael Scheper
Hello again, I poked at this a bit more yesterday and traced this problem to core Python behaviour. The critical line of Django code is in the django.utils.translation.trans_real.translation(language) function, in _translation() under _fetch(): t = gettext_module.translation('django', path, [loc

Authentication for static files

2009-09-26 Thread Ben Davis
I would like to be able to serve files that were uploaded via the admin site; for example, when someone clicks on the "Currently:" file link in the changeform. However, I also have the following requirements: 1. The file should only be accessible when authenticated via django's auth system

Re: IGNORABLE_404 woes

2009-09-26 Thread Michael
On Sat, Sep 26, 2009 at 11:15 AM, troyhitch wrote: > > Hi everyone - > > I have deployed two django sites on the same server, with identical > configs (apache, mod_wsgi) and have added this to each of their > settings.py: > > IGNORABLE_404_STARTS = ('/cgi-bin/',) > IGNORABLE_404_ENDS = ('favicon.

Re: Composite Key Issue

2009-09-26 Thread Karen Tracey
On Sat, Sep 26, 2009 at 9:03 AM, Robb Bossley wrote: > All, > > I am struggling to fix a database in such a way that I can make sure that > each entry is unique within its framework. > > Suppose the following, in a library setting: > > (Using Django 1.0 and SQL Server) > > An author may have multi

Re: Question about Aggregates and Annotations

2009-09-26 Thread Derek Willis
How about using filter() before annotate() Topic.objects.filter(subtopics__trashed_at__isnull=true, subtopics__complete_at__isnull=True).annotate(Count('subtopics')) That filters out the records you don't want and then performs the annotation on the remaining set. On Sep 26, 6:04 am, "oliver.an

Question about Aggregates and Annotations

2009-09-26 Thread oliver.andrich
Hi, is it possible to constrain a Count aggregate by adding some extra filters? I have a model which has a self referentiell foreign key. class Topic(models.Model): ... topic = models.ForeignKey('self', related_name='subtopics', null=True, blank=True) ... Now I wo

strange problem with floatformat

2009-09-26 Thread jonathan
Hi, I am having a strange problem with floatformat (filter) and I wonder if anyone else has seen it. I am using google app engine and am storing decimal.Decimal objects in the datastore that I am displaying in a template as money values so I am doing foo.methodThatReturnsDecimal|floatformat:2. T

Re: Composite Key Issue

2009-09-26 Thread Robb Bossley
Thanks again, Karen - you rock! Does it automagically do this, or do I need to enter a rule (in views, perhaps) to check it during validation? I mean, I now have "if form.is_valid" (though I don't recall if I had that originally). On Sat, Sep 26, 2009 at 10:26 AM, Karen Tracey wrote: > On Sat,

Re: multi-db vs. data warehouse

2009-09-26 Thread Joshua Russo
No one is recommending multi-db because it's not done yet. I'm not sure I understand exactly what you mean by "creating new order and order_item data with keys to data in the warehouse" but that doesn't sound like a recommended approach. A data warehouse (in my opinion) should be read only and no

Re: Composite Key Issue

2009-09-26 Thread Karen Tracey
On Sat, Sep 26, 2009 at 10:09 AM, Robb Bossley wrote: > Karen, > > When I had tried previously, it seemed that Django would not ensure that > the four fields coupled together would be unique - I believe I tried it - > and that is why I switched things around. > > How are you adding entries? The u

admin list_display

2009-09-26 Thread paulh
Using the admin list_display and a callable with its allow_tags property set to True you can plant a link for each object on the changle_list display page of the admin. Is there some way of making this link dynamic without having to extend the ModelAdmin.changelist_view and its associated template

Re: starting a new site with django

2009-09-26 Thread Daniel Roseman
On Sep 25, 11:30 pm, Ronen Gal wrote: > Hi, > > I would like to build a website which sells videos (music lessons). > The site would include ~50 videos, 150MB each. > I need some kind of shopping cart, and the ability to recieve payment. > I also need user accounts, so I can learn my users flavou

Composite Key Issue

2009-09-26 Thread Robb Bossley
All, I am struggling to fix a database in such a way that I can make sure that each entry is unique within its framework. Suppose the following, in a library setting: (Using Django 1.0 and SQL Server) An author may have multiple books. The books may have the same price. They may even have the

Re: Django 1.0 cannot handle ManyToOne inheritance in two apps

2009-09-26 Thread luciferleo
Yeah, you're right. Thanks. On Sep 25, 4:51 pm, Daniel Roseman wrote: > On Sep 25, 3:30 am, luciferleo wrote: > > > > > Hi, I am using Django 1.0 > > Suppose I have two models in one file: > > > class BaseModel(models.Model): > >     # attrs > >     creator = models.ForeignKey('User', related_n

IGNORABLE_404 woes

2009-09-26 Thread troyhitch
Hi everyone - I have deployed two django sites on the same server, with identical configs (apache, mod_wsgi) and have added this to each of their settings.py: IGNORABLE_404_STARTS = ('/cgi-bin/',) IGNORABLE_404_ENDS = ('favicon.ico','.php','robots.txt') It works perfectly for one site, but not

Re: can't show admin interface

2009-09-26 Thread nausikaa
Have you done from yourapp.models import * from django.contrib import admin admin.site.register(Books) in admin.py? On Sep 26, 4:55 am, pengwupeng wrote: > the environment is  apache+django, accessing   my app is ok,but i > can't access the admin interface. > the configuration  of the http

Re: are django applications portable?

2009-09-26 Thread Bryan
It is definitely possible to "install" django-tagging on your project path if you really wanted to. I did this for a while and it worked just fine. You could export the latest version from source control or alternatively do the install and then move files from the python packages directory to yo

Re: Comments and objects

2009-09-26 Thread Rodney Topor
On Sep 22, 11:15 pm, Daniel Roseman wrote: > On Sep 22, 2:07 pm, RodneyTopor wrote: > > > Suppose a user posts a comment about a particular object, using > > django.contrib.comments, as described in Practical Django Projects. > > How can one get access to this object in a template such as > > pos

Re: redirect to enter page

2009-09-26 Thread Brian McKeever
This should do what you want: http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.decorators.permission_required On Sep 25, 2:35 pm, Dan Cox wrote: > Django Users, > > I'm pretty new to django so please excuse my ignorance. > > I'd like to redirect users to an "enter" page no m