Re: PostgreSQL or MySQL, What are the +'s and -'s?
Wow, that's a cool trick to be able to implement stored procedures in different languages. I might actually use them more if I could do everything in the same language as the application. I only looked quickly through the PostgreSQL docs for subqueries. Thanks for the heads up. As far as the Gis functionality goes, I could see a database like that needing some serious horse power if it became popular. Any thoughts on how that would reconcile with the weakness in replication? I suppose most Gis systems are more for out put than input so the slow replication might not really matter that much. On Sat, Sep 5, 2009 at 1:17 AM, Siemsterwrote: > > PostgreSQL does support subqueries in the from clause, however iirc, > the subquerys require an alias. > > If you decide to do geo then the PostGis addon to Postgres is very > nice. > > Another nice capability in PostgreSQL is that you can use different > languages for writing your stored procedures (should you wish to use > them). Some of the available languages (in addition to PL/pgSQL) are > Perl, Python, Tcl, PHP, Ruby, R, Scheme, and Java. > > Whether you choose to use Postgres or not, I'd recommend at least > looking at it. There is even a live cd (which I have not tried) at > http://www.postgresql.org/download/ which lets you try PostgreSQL out > without having to install it. > > > > On Sep 4, 7:38 pm, Joshua Russo wrote: > > On Fri, Sep 4, 2009 at 11:07 PM, Tim Chase > > wrote: > > > > > > > > > > > > > > I personally don't have any experience with PostgreSQL and I'm > generally > > > > working in a mixed MS and Linux environment. I'm interested to hear > > > peoples > > > > views on the pluses and minuses of the two different systems. I'm a > bit > > > of a > > > > query geek too. How does that play in? I know in MySQL there are > > > limitations > > > > on where you can use subqueries. Is that true with PostgreSQL? (Ya I > > > could > > > > just look that one up but it's just an example.) > > > > > I did a writeup of MySQL vs. PostgreSQL a while back: > > > > >http://www.mail-archive.com/django-users@googlegroups.com/msg70188.html > > > > > Most of the issues still stand -- though I understand MySQL now > > > has native(ish) support for Geo information (check the GeoDjango > > > code to see if it supports the MySQL Geo implementation -- last I > > > checked the source it was Oracle & PostgreSQL only). > > > > > To answer your direct question, PostgreSQL has long-standing > > > support for all kinds of crazy sub-queries. MySQL has added most > > > of those abilities over time. This used to be a deal-breaker for > > > me, making Postgres the clear winner. Now they're about even. > > > > > Lastly, my closing arguments in that link still stand -- if you > > > don't have a pressing need to choose one or the other, code & > > > test for both. > > > > Good point on geo side side of things. > > > > One place I have found subqueries very useful is in the From. > Functionally > > identical to a view but you don't need to clutter the database with > rarely > > used views. That and you can use variables. If you really wanted to get > > fancy you can even nest them. It can save a lot on application logic and > > produce some interesting reports. I don't believe either of our friends > here > > support them though. That is one feature I would love to see. > > > > I tend to agree with your closing arguments. I try to stay away from any > > DBMS unique functionality. I very rarely even find much of a need for > > triggers and/or stored procedures. (But they can come in exceptionally > handy > > when turning 10s of 1000s of rows of un-normalized data, into close to a > > million rows of normalized. Done in a matter of minutes!) > > > --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django fuzzy string translation not showing up
On Fri, Sep 4, 2009 at 7:24 PM, weiweiwrote: > > 1)why sometimes i got 'fuzzy' item in django.po language file . > Actually i have checked in my project the 'fuzzy' string item is > totally unique. > > #: .\users\views.py:81 .\users\views.py:101 > #, fuzzy > msgid "username or email" > msgstr "9988" > > 2) It is ok to be fuzzy but my translation of fuzzy item not showing > up on the page , only English version shows up. It is totally odd. > > Thanks for any help! > > I don't know what you mean by "It is ok to be fuzzy". Entries marked fuzzy are considered to be not translated. The fuzzy translation has to be manually verified and the fuzzy marker has to be removed before the translation will be considered valid and thus used. This is discussed a bit in this ticket: http://code.djangoproject.com/ticket/10852 Karen --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: PostgreSQL or MySQL, What are the +'s and -'s?
PostgreSQL does support subqueries in the from clause, however iirc, the subquerys require an alias. If you decide to do geo then the PostGis addon to Postgres is very nice. Another nice capability in PostgreSQL is that you can use different languages for writing your stored procedures (should you wish to use them). Some of the available languages (in addition to PL/pgSQL) are Perl, Python, Tcl, PHP, Ruby, R, Scheme, and Java. Whether you choose to use Postgres or not, I'd recommend at least looking at it. There is even a live cd (which I have not tried) at http://www.postgresql.org/download/ which lets you try PostgreSQL out without having to install it. On Sep 4, 7:38 pm, Joshua Russowrote: > On Fri, Sep 4, 2009 at 11:07 PM, Tim Chase > wrote: > > > > > > > > I personally don't have any experience with PostgreSQL and I'm generally > > > working in a mixed MS and Linux environment. I'm interested to hear > > peoples > > > views on the pluses and minuses of the two different systems. I'm a bit > > of a > > > query geek too. How does that play in? I know in MySQL there are > > limitations > > > on where you can use subqueries. Is that true with PostgreSQL? (Ya I > > could > > > just look that one up but it's just an example.) > > > I did a writeup of MySQL vs. PostgreSQL a while back: > > >http://www.mail-archive.com/django-users@googlegroups.com/msg70188.html > > > Most of the issues still stand -- though I understand MySQL now > > has native(ish) support for Geo information (check the GeoDjango > > code to see if it supports the MySQL Geo implementation -- last I > > checked the source it was Oracle & PostgreSQL only). > > > To answer your direct question, PostgreSQL has long-standing > > support for all kinds of crazy sub-queries. MySQL has added most > > of those abilities over time. This used to be a deal-breaker for > > me, making Postgres the clear winner. Now they're about even. > > > Lastly, my closing arguments in that link still stand -- if you > > don't have a pressing need to choose one or the other, code & > > test for both. > > Good point on geo side side of things. > > One place I have found subqueries very useful is in the From. Functionally > identical to a view but you don't need to clutter the database with rarely > used views. That and you can use variables. If you really wanted to get > fancy you can even nest them. It can save a lot on application logic and > produce some interesting reports. I don't believe either of our friends here > support them though. That is one feature I would love to see. > > I tend to agree with your closing arguments. I try to stay away from any > DBMS unique functionality. I very rarely even find much of a need for > triggers and/or stored procedures. (But they can come in exceptionally handy > when turning 10s of 1000s of rows of un-normalized data, into close to a > million rows of normalized. Done in a matter of minutes!) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Users Full Name in model form?
Is this within the Admin interface? If so, I'm having a similar problem. I have a model called Request with a FK relationship to an Employee model. Within the Admin interface, when adding a Request, the drop-down of the Employees selection read "Employee Object". This is also the case when listing the Employees. There is no way to distinguish between the employees. How do I change, what I think is called the "string representation" of the object within the Admin interface. Also, is there some sort of naming convention when creating models to get these fields automatically? On Fri, Sep 4, 2009 at 1:26 PM, Streamweaverwrote: > > I had a model that lists an owner with a FK relationship to the Users > table. > > When using model form the dropdown for the owner field defaults to the > username. > > I'd like to override that to use a users name as the choice portion of > the dropdown sorted by users last name but I'm having trouble thinking > through how to do this. > > Can anyone point me to an example of something like this? > > > --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: PostgreSQL or MySQL, What are the +'s and -'s?
On Fri, Sep 4, 2009 at 11:07 PM, Tim Chasewrote: > > > I personally don't have any experience with PostgreSQL and I'm generally > > working in a mixed MS and Linux environment. I'm interested to hear > peoples > > views on the pluses and minuses of the two different systems. I'm a bit > of a > > query geek too. How does that play in? I know in MySQL there are > limitations > > on where you can use subqueries. Is that true with PostgreSQL? (Ya I > could > > just look that one up but it's just an example.) > > I did a writeup of MySQL vs. PostgreSQL a while back: > > http://www.mail-archive.com/django-users@googlegroups.com/msg70188.html > > Most of the issues still stand -- though I understand MySQL now > has native(ish) support for Geo information (check the GeoDjango > code to see if it supports the MySQL Geo implementation -- last I > checked the source it was Oracle & PostgreSQL only). > > To answer your direct question, PostgreSQL has long-standing > support for all kinds of crazy sub-queries. MySQL has added most > of those abilities over time. This used to be a deal-breaker for > me, making Postgres the clear winner. Now they're about even. > > Lastly, my closing arguments in that link still stand -- if you > don't have a pressing need to choose one or the other, code & > test for both. Good point on geo side side of things. One place I have found subqueries very useful is in the From. Functionally identical to a view but you don't need to clutter the database with rarely used views. That and you can use variables. If you really wanted to get fancy you can even nest them. It can save a lot on application logic and produce some interesting reports. I don't believe either of our friends here support them though. That is one feature I would love to see. I tend to agree with your closing arguments. I try to stay away from any DBMS unique functionality. I very rarely even find much of a need for triggers and/or stored procedures. (But they can come in exceptionally handy when turning 10s of 1000s of rows of un-normalized data, into close to a million rows of normalized. Done in a matter of minutes!) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Slash character in {% blocktrans %} ... {% endblocktrans %} tempalte tag: xgettext argument issue
I create multilingual application with django and i've found that template tag {% blocktrans %} doesn't accept properly html tags, especially slash character. It's a pity and I've found a solution: add -E argument to makemessage command from django.core.management.commands. In xgettext man page that described as "use C escapes in output, no extended chars". This is my question: is this a bug and if not how I can use HTML tags (or slash character) in my translations without monkey-patch? --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: PostgreSQL or MySQL, What are the +'s and -'s?
Nice! thanks for that one. On Fri, Sep 4, 2009 at 10:59 PM, Continuationwrote: > > MySQL has better replication support. > > MySQL has built-in replication based on log shipping. > > Postgresql doesn't have built in replication. You have to use external > tools. From > http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL#PostgreSQL_Replication_Weakness > : > > "Slony-I, the most widely used PostgreSQL replication tool, is > inherently inferior to MySQL's built in replication for a number of > reasons. First, it uses SQL and triggers to replicate the data across > servers. This is considerably slower than MySQL's binary log shipping > and makes the communication costs much higher. Second, Slony-I's > communication costs grow quadratically in relation to the number of > servers in the replication pool (Order(n^2)). This makes it inherently > unusable for larger clusters. If we conservatively figure that Slony- > I's SQL/trigger method takes twice as much communication as MySQL's > binary log shipping, we can easily see how poorly this would work for > larger clusters in the real world. > > With two servers: MySQL: 2 = 2 PostgreSQL: 2*2^2 = 8 > > With 4 servers: MySQL: 4 = 4 PostgreSQL: 2*4^2 = 32 > > With 12 servers: MySQL: 12 = 12 PostgreSQL: 2*12^2 = 288. > > > > On Sep 4, 4:29 pm, Joshua Russo wrote: > > I personally don't have any experience with PostgreSQL and I'm generally > > working in a mixed MS and Linux environment. I'm interested to hear > peoples > > views on the pluses and minuses of the two different systems. I'm a bit > of a > > query geek too. How does that play in? I know in MySQL there are > limitations > > on where you can use subqueries. Is that true with PostgreSQL? (Ya I > could > > just look that one up but it's just an example.) > > > --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: PostgreSQL or MySQL, What are the +'s and -'s?
> I personally don't have any experience with PostgreSQL and I'm generally > working in a mixed MS and Linux environment. I'm interested to hear peoples > views on the pluses and minuses of the two different systems. I'm a bit of a > query geek too. How does that play in? I know in MySQL there are limitations > on where you can use subqueries. Is that true with PostgreSQL? (Ya I could > just look that one up but it's just an example.) I did a writeup of MySQL vs. PostgreSQL a while back: http://www.mail-archive.com/django-users@googlegroups.com/msg70188.html Most of the issues still stand -- though I understand MySQL now has native(ish) support for Geo information (check the GeoDjango code to see if it supports the MySQL Geo implementation -- last I checked the source it was Oracle & PostgreSQL only). To answer your direct question, PostgreSQL has long-standing support for all kinds of crazy sub-queries. MySQL has added most of those abilities over time. This used to be a deal-breaker for me, making Postgres the clear winner. Now they're about even. Lastly, my closing arguments in that link still stand -- if you don't have a pressing need to choose one or the other, code & test for both. -tim --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: PostgreSQL or MySQL, What are the +'s and -'s?
MySQL has better replication support. MySQL has built-in replication based on log shipping. Postgresql doesn't have built in replication. You have to use external tools. From http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL#PostgreSQL_Replication_Weakness: "Slony-I, the most widely used PostgreSQL replication tool, is inherently inferior to MySQL's built in replication for a number of reasons. First, it uses SQL and triggers to replicate the data across servers. This is considerably slower than MySQL's binary log shipping and makes the communication costs much higher. Second, Slony-I's communication costs grow quadratically in relation to the number of servers in the replication pool (Order(n^2)). This makes it inherently unusable for larger clusters. If we conservatively figure that Slony- I's SQL/trigger method takes twice as much communication as MySQL's binary log shipping, we can easily see how poorly this would work for larger clusters in the real world. With two servers: MySQL: 2 = 2 PostgreSQL: 2*2^2 = 8 With 4 servers: MySQL: 4 = 4 PostgreSQL: 2*4^2 = 32 With 12 servers: MySQL: 12 = 12 PostgreSQL: 2*12^2 = 288. On Sep 4, 4:29 pm, Joshua Russowrote: > I personally don't have any experience with PostgreSQL and I'm generally > working in a mixed MS and Linux environment. I'm interested to hear peoples > views on the pluses and minuses of the two different systems. I'm a bit of a > query geek too. How does that play in? I know in MySQL there are limitations > on where you can use subqueries. Is that true with PostgreSQL? (Ya I could > just look that one up but it's just an example.) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django, Blueprintcss and a data array
I (newbie) am looking at using Blueprintcss to display a 7 column array of data. The data is passed to the template in "dataarray". I have tested the code below without the section and the column headings display correctly. Adding the section to the code causes an error at {% for row in dataarray %}: Caught an exception while rendering: 'int' object is not iterable Very similar code in a template that uses a simple table (without Blueprint) does not throw an error. {% extends "base.html" %} {% block content %} Agent summary report The most recent listing for each property listed within the past 12 weeks Address Date Price Method Agent Mobile {% for row in dataarray %} {% for item in row %} {{ item }} {% endfor %} {% endfor %} {% endblock %} Any hints, or pointers to the display of multi-row columned data would be appreciated. Mike Rowan --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django fuzzy string translation not showing up
1)why sometimes i got 'fuzzy' item in django.po language file . Actually i have checked in my project the 'fuzzy' string item is totally unique. #: .\users\views.py:81 .\users\views.py:101 #, fuzzy msgid "username or email" msgstr "9988" 2) It is ok to be fuzzy but my translation of fuzzy item not showing up on the page , only English version shows up. It is totally odd. Thanks for any help! --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: PostgreSQL or MySQL, What are the +'s and -'s?
On Fri, Sep 4, 2009 at 9:01 PM, Léon Dignònwrote: > > One of many: > PostgreSQL supports naive foreign referential-integrity constraints. > MySQL (default: myISAM) does it only with InnoDB which leads to other > Problems: http://dev.mysql.com/doc/refman/5.0/en/innodb-configuration.html > > On Sep 4, 10:29 pm, Joshua Russo wrote: > > I personally don't have any experience with PostgreSQL and I'm generally > > working in a mixed MS and Linux environment. I'm interested to hear > peoples > > views on the pluses and minuses of the two different systems. I'm a bit > of a > > query geek too. How does that play in? I know in MySQL there are > limitations > > on where you can use subqueries. Is that true with PostgreSQL? (Ya I > could > > just look that one up but it's just an example.) > Yup, that one I got. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Users Full Name in model form?
I put a solituion for this in the form of where this is passed a user object. class UserChoiceField(forms.ModelChoiceField): ''' Returns a select field with user names formatted by last and first name where available and ordered by last name. ''' def label_from_instance(self, obj): if obj.last_name or obj.first_name: display = ", ".join((obj.last_name, obj.first_name)) else: display = obj.username return display On Sep 4, 2:26 pm, Streamweaverwrote: > I had a model that lists an owner with a FK relationship to the Users > table. > > When using model form the dropdown for the owner field defaults to the > username. > > I'd like to override that to use a users name as the choice portion of > the dropdown sorted by users last name but I'm having trouble thinking > through how to do this. > > Can anyone point me to an example of something like this? --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: PostgreSQL or MySQL, What are the +'s and -'s?
One of many: PostgreSQL supports naive foreign referential-integrity constraints. MySQL (default: myISAM) does it only with InnoDB which leads to other Problems: http://dev.mysql.com/doc/refman/5.0/en/innodb-configuration.html On Sep 4, 10:29 pm, Joshua Russowrote: > I personally don't have any experience with PostgreSQL and I'm generally > working in a mixed MS and Linux environment. I'm interested to hear peoples > views on the pluses and minuses of the two different systems. I'm a bit of a > query geek too. How does that play in? I know in MySQL there are limitations > on where you can use subqueries. Is that true with PostgreSQL? (Ya I could > just look that one up but it's just an example.) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Same application with different URLs
One more note, just if somebody else runs into this. Apparently, the problem with this solution is that under certain conditions, SetEnv from one virtual host can be visible inside the Python interpreter associated with another virtual host. Since mod_python suggests not to use SetEnv, one should probably not be surprised all that much. A working solution is to branch on something else than the environment variable in urls.py. Using apache.interpreter imported from mod_python seems to work just fine. Petr --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
PostgreSQL or MySQL, What are the +'s and -'s?
I personally don't have any experience with PostgreSQL and I'm generally working in a mixed MS and Linux environment. I'm interested to hear peoples views on the pluses and minuses of the two different systems. I'm a bit of a query geek too. How does that play in? I know in MySQL there are limitations on where you can use subqueries. Is that true with PostgreSQL? (Ya I could just look that one up but it's just an example.) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with content type creation order and data recovery scheme
On Fri, Sep 4, 2009 at 6:37 PM, James Bennettwrote: > > On Fri, Sep 4, 2009 at 7:35 AM, Joshua Russo > wrote: > > The reason I was looking at the dump data instead of a MySQL backup is > > because it was more obvious to automate. I'm going to take a closer look > at > > the MySQL backup though. > > I run on PostgreSQL rather than MySQL, but for what it's worth my > backup scheme is just a little bash script, which runs as a cron job > each night and: > > 1. Runs pg_dump. > 2. Compresses the result. > 3. Puts a copy in a local backups directory, and pushes copies to two > off-site backup systems. > > Restoring from this is trivial; all I have to do is create an empty > database, and pip the dump file to it. The only time I ever used > fixtures for a dump/restore was when migrating across database > platforms (e.g., away from MySQL a couple years ago), and that was > really more of a special case. Ya, the more I think about it, it's silly to not use the MySQL backup, it's what it's there for. I'm sure there are some ways I can script it. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
User account specific to site
Is it at all possible with Django's contrib Auth system for a single username to correspond to a different user account on each Site, or would I need to write a custom auth app / use a different DB for each site? Thanks! --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with content type creation order and data recovery scheme
On Fri, Sep 4, 2009 at 7:35 AM, Joshua Russowrote: > The reason I was looking at the dump data instead of a MySQL backup is > because it was more obvious to automate. I'm going to take a closer look at > the MySQL backup though. I run on PostgreSQL rather than MySQL, but for what it's worth my backup scheme is just a little bash script, which runs as a cron job each night and: 1. Runs pg_dump. 2. Compresses the result. 3. Puts a copy in a local backups directory, and pushes copies to two off-site backup systems. Restoring from this is trivial; all I have to do is create an empty database, and pip the dump file to it. The only time I ever used fixtures for a dump/restore was when migrating across database platforms (e.g., away from MySQL a couple years ago), and that was really more of a special case. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Users Full Name in model form?
I had a model that lists an owner with a FK relationship to the Users table. When using model form the dropdown for the owner field defaults to the username. I'd like to override that to use a users name as the choice portion of the dropdown sorted by users last name but I'm having trouble thinking through how to do this. Can anyone point me to an example of something like this? --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Same application with different URLs
Hi Andrew, > What is the error 500? Is it the same error every time? I did not find any details in the logs and with DEBUG = True, the site starts behaving correctly. > Also, you have restarted apache? Different apache processes could be > out of sync and running different django configs, thus giving > different outcomes. Yes, to no avail. After half a day of experimenting, it looks like using the transactional middleware to make a separate transaction for every request was what was needed (still testing to make sure everything works, but I did not see the error for some time now. Thanks, Petr --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Retrieving browser information(javascript enabled)
I need a javascript enabled check in my templates and it's not hard to do, but I think I saw on the docs that django already gave that information through one of the frameworks api, but I don't remember which. Where in the docs is it? Or was I just dreaming? --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
can .values() return the field of child model
Hi Can .values() method return fields of child model i.e fields of forward relation across a database --- Subramanyam --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to deploy an app that gets used by people in multiple time zones
On Sep 4, 10:47 am, Margiewrote: > > Can someone clarify what format dates and times are stored in when > using just a standard DateTimeField? Is my timezone encoded in the > database or is some generic, non-timezone-specific date/time stored? There is no timezone encoded. The dates/times are said to be "naive". It is up to you to assign meaning to the time and to convert to the appropriate timezone for your users. You should probably review this: http://docs.python.org/library/datetime.html Regards, BN PS. The pytz library is useful for performing conversions between timezones. http://pytz.sourceforge.net/ --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to deploy an app that gets used by people in multiple time zones
I am using mysql. Can someone clarify what format dates and times are stored in when using just a standard DateTimeField? Is my timezone encoded in the database or is some generic, non-timezone-specific date/time stored? I don't understand why I would want to save my timezone along with my date/time. It seems to me that I should just be saving the generic form of the date/time and then rendering it in the format approriate for the user that it is being rendered for. IE, use the timezone only when rendering, not when saving. Margie On Sep 4, 12:22 am, Maksymus007wrote: > On Thu, Sep 3, 2009 at 11:36 PM, Margie > > > > Roginski wrote: > > > I've created a django app and I soon am going to have users that are > > in multiple timezones. My app is a task management system and it is > > important for users to see dates and times with respect to their own > > time zone. IE, if here in California I create a task at 3PM on Sept > > 3, I want someone in India to see it as being created at 1AM on Sept > > 4. Optimally, if that India employee travels to the US and looks at > > the task creation date, they should see 3PM on Sept 3. Is there a > > "best" way to handle this? Things that come to mind are: > > > 1. Create a deployment for each of my time zones where TIME_ZONE and > > DATE_FORMAT are set appropriately for the time zone associated with > > the deployment. This seems painful ... > > > 2. Have a single deployment and whenever I display dates, use some > > sort of tag that can figure out how to display the date correctly > > based on the user's time zone > > > 3. I see there is a reusable app called django-timezones. There is > > not much doc with it, but I'm guessing this is targeted at what I am > > trying to do. > > > Can anyone give any recommendations? I'm happy to dive in and read > > source (ie, for django-timezones app), but I just want to make sure > > I'm heading in the right direction. > > > Thanks, > > have you tried to use postgres timestamp with time zone field? It has > ability to make such a conversion on the fly and every date can be > stored with timezone --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Zip multiple files into a zipped folder for download?
Here is how I do it http://dpaste.com/89530/ I am using a View class that I wrote to make my life easier so it wont directly translate to a standard view function but it should give you enough details to get you started --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Outputing an integer value in a template, but with some calculation done on it
If you're using Pagination http://docs.djangoproject.com/en/dev/topics/pagination/ you can get the previous and next pages like this: {{ current_page.previous_page_number }} If not, check it out. It's a simple way to manage pagination issues. HTH, Matias. On Thu, Sep 3, 2009 at 8:25 PM, Tim Chasewrote: > > > I am trying to output a variable page_no to a template, but I want to > output > > page_no + 1 and page_no - 1. How do I do that? I tried to do something > like > > {{ page_no + 1 }} and that failed. Tried {% and %} as well, but no > success. > > > > Surely there is a way to do this other than having to calculate these > values > > in the view ahead of time? > > You bet -- you want the "add" filter: > > {{ page_no|add:"1" }} > > detailed at > > http://docs.djangoproject.com/en/dev/ref/templates/builtins/#add > > -tim > > > > > > > > -- :wq --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using Psycopg2 on Windows
Thanks James ! --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Add buttons to change_form
Hi friends, I have a problem. I want add buttons to change_form, and I did the same thing of Django, I wrote a templatetags, but I have a doubt in the views. I want do something as: def newdescriptor(request): if request.method == 'POST': form = CustomNewForm(request.POST) if form.is_valid(): if 'checked' in request.POST: new = Descriptor(term = form.cleaned_data['term'], note = form.cleaned_data['note']) new.save() return HttpResponseRedirect('/admin/new/%s' % new.id) I did this function, and it works, but I used it in my custom form (CustomNewForm), and I have modify it for use it in change_form In this case, "checked" is a button, Descriptor is a model, and term and note are attributes. I create an instance of Descriptor when I press "checked" button. My doubt is how modify it for use it in chage_form? Because in this case, my "form" is..? Please, help, really I need do that. Thanks --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is valid {% ifequal model.name "Mymodelname" %}??
I'm going to take a flier and guess that you want this to be conditional on the name of the class of an instance passed in the context. That is, you have a model class Foo, maybe another named Bar that you have an instance of the class, e.g.; x = Foo.objects.get(pk=1), and that you're passing it into a template, e.g.; context(..., model=x,...). In this case, try something like: {% ifequal model.__class__.__name__ "Foo" %} ... Remember, you can always temporarily add something like {{ model.name }} to the text to see what you're comparing to that string. Bill On Wed, Sep 2, 2009 at 11:44 AM, Sandra Djangowrote: > Hi friends, Can I do a condition depending on my model name? For example, I > did that: > {% ifequal model.name "Mymodelname" %} > do something > {% endifequal %} > > But don't work. Someone could help me? > > > > --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Cloning/using Django admin without auth_ and django_ database tables?
Hi Russel, thanks for the tip. > There isn't a simple switch of setting to do this out-of-the-box. > However, it _might_ be possible with some creative subclassing. I might try this, but I'm afraid that it is a fair bit beyond my Django/Python skills. Maybe I have to bite the bullet and write some model forms myself for the updating of the database. Thanks anyhow, Ulf --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with content type creation order and data recovery scheme
On Fri, Sep 4, 2009 at 10:37 AM, Russell Keith-Mageewrote: > > On Fri, Sep 4, 2009 at 4:57 PM, Joshua Russo > wrote: > > My goal here is to create a backup and recovery scheme, where recovery is > > possible on any computer. > > I've been performing incremental updates to an application that people > have > > started to use. The incremental updates seem to have created a problem > for > > the dump and load data functions when trying to reload into a fresh > > database. I tried to use dump data to create an __ initial __ .json file, > > but I received a duplication error on load, I think from the unique index > > (not the primary key) on the content type. I believe this is because > > the tables (and thus content types) are created in a different order when > > doing a syncdb from scratch, as opposed to incrementally on the old > > production machine. > > > Firstly, does anyone have a more elegant solution to the dump and load > data > > problem specifically? > > You've pretty much correctly diagnosed the problem that you are > experiencing. It's well known to the core, and is logged as #7052. > > I've had a solution in mind for a while, but never got around to > implementing it. However, just before v1.1 was released, a patch was > offered that implements my proposed solution. I expect this patch (or > something like it) will be in v1.2. > > However, that said... > > > Second, what do you use for a data backup and recovery scheme for your > > Django data? > > I'm unclear why normal MySQL backup tools aren't the obvious first > solution here. Yes, Django does provide data dumping and loading > tools, but they are primarily designed for small fixtures for tests > and initial database setup. > > I'm not saying that loaddata and dumpdata _can't_ be used on large > data sets, when you're talking about backing up the entire database, > the database is going to be able to provide much better tools than > Django will. Trying to build a backup and recovery system without > using the tools closest to the data seems like a lot of extra work to > me. > > You also appear to be conflating two separate problems. Talking about > the fragility of fixtures when the database changes isn't a problem > specific to fixtures - any data dumping scheme will experience the > same problems. Some data loading schemes might be more robust to > simple changes, but for anything other than trivial changes, you're > going to need a much more sophisticated approach than "dump the data > and reload it". This is a schema evolution issue, not a backup issue. > The reason I was looking at the dump data instead of a MySQL backup is because it was more obvious to automate. I'm going to take a closer look at the MySQL backup though. I have a special case. It's a small app on a computer only connected (via crossover) to one other. The backup process will include copying onto a pen drive. There is also the strong likely hood that if they have do have the need to restore the database, I won't be here. I'm a volunteer in the Peace Corps. The app is only suppose to be a stop gap until the national government brings in their own app, but that depends on other factors that could potentially take years. Thus I need to create a simple yet fool proof process for "disaster recovery". That said, I see that my only real option should be the MySQL backup and restore. This is how I ended up moving the data anyway. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Zip multiple files into a zipped folder for download?
> I've got an advanced question. I'm not sure it's *that* advanced :) > How do i create a zip file that contain multiple files and folders in > the zip file? You can use Python's built-in zipfile[1] module. import cStringIO as cs import zipfile as z f = cs.StringIO() # or a file on disk in write-mode zf = z.ZipFile(f, 'w', z.ZIP_DEFLATED) zf.write('file.html') zf.write('file.php') zf.write('file.css') zf.write('folder/fileinsubfolder.html') zf.write('folder/fileinsubfolder.php') zf.close() # f is now a zip-file containing the desired structure Given the small size of the resulting zip file you describe, I'd build the whole thing in memory. If you're building a much larger file, I'd use an on-disk file and then stream that out over the connection. Just remember that you'd then have files on disk that you may need to clean up afterwards. Also remember that multiple processes writing files can trigger file-name collisions if you're not careful. > And the zip file is available for download? Once you have the resulting file, send the correct mime-type header (application/zip) and then just send the file. You can write the whole file (if it's small and in-memory), or you can stream the file with a generator (from a source on disk), or if you're using a server that supports the "send file" directive, you can point it at an on-disk file and let the server do the heavy lifting instead of tying up a Django process. -tim [1] http://docs.python.org/library/zipfile.html --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Cloning/using Django admin without auth_ and django_ database tables?
On Fri, Sep 4, 2009 at 1:31 PM, Ulf Kronmanwrote: > > Hi all, > > I’m using Django to build an Intranet web interface to a big legacy > database running in a MS SQL Server. > With the help of the code from the guys over at the django_pyodbc > project (http://code.google.com/p/django-pyodbc/) I have managed to > get things working quite well against this “alien” database manager. > In a local copy of the legacy database on my Windows laptop I can > browse and update records, using both my own forms and the admin > interface. > > Now I want to move the web interface to an Ubuntu Linux server that is > supposed to act as an Intranet web interface against the MS SQL > database. I have my own forms working for updating from the Linux web > to the MS server, but I would also like to make use of the excellent > Django admin interface for managing data on the server. > > The problem I’m facing here is that I’m not in charge of the legacy > database, and I can’t get the rights to install the tables for > authorisation, sessions and content management that the Django admin > interface seems to be dependent on. > > I have been fiddling with multi database management with a bit of > luck, (thanks to > http://www.mechanicalgirl.com/view/multiple-database-connection-a-simple-use-case/ > and http://www.eflorenzano.com/blog/post/easy-multi-database-support-django/), > the idea being to have a local PostgreSQL on the Linux box as the > default database for the tables needed by Django admin and switching > over to the MS database for the actual data handling. Browsing and > reading works fine, but I can’t get the multi-db management to work > properly for updating of records on the MS SQL Server. This may be due > to the non-supported code for MS SQL doing non-standard requests or to > my lack of knowledge. > > So, my bottom line question is: Is there by chance any way to turn off > authorisation in the Django admin or is there a way I could clone the > functionality of the admin interface and use it without authorisation, > sessions and content management, so that it won’t need to access any > of the auth_ or django_ tables in the database? There isn't a simple switch of setting to do this out-of-the-box. However, it _might_ be possible with some creative subclassing. The admin site is just an instance of the AdminSite class. This class can be subclassed if you want to.. For example, you could remove all login requirements by overriding the has_permission() method to return True without reference to the User table. The ModelAdmin class can also be subclassed - this class exposes a few more methods that would need to be overridden - again, permissions methods (has_add_permission, has_change_permission, has_delete_permission), plus some logging methods (log_addition, log_change, log_deletion) and message sending methods (message_user) Caveat: I haven't tried any of this, so I might be completely wrong. You're in unexplored territory, so you're probably going to need to do some code spelunking to make it work and find all the places that the auth_ and django_ tables are used. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with content type creation order and data recovery scheme
On Fri, Sep 4, 2009 at 4:57 PM, Joshua Russowrote: > My goal here is to create a backup and recovery scheme, where recovery is > possible on any computer. > I've been performing incremental updates to an application that people have > started to use. The incremental updates seem to have created a problem for > the dump and load data functions when trying to reload into a fresh > database. I tried to use dump data to create an __ initial __ .json file, > but I received a duplication error on load, I think from the unique index > (not the primary key) on the content type. I believe this is because > the tables (and thus content types) are created in a different order when > doing a syncdb from scratch, as opposed to incrementally on the old > production machine. > Firstly, does anyone have a more elegant solution to the dump and load data > problem specifically? You've pretty much correctly diagnosed the problem that you are experiencing. It's well known to the core, and is logged as #7052. I've had a solution in mind for a while, but never got around to implementing it. However, just before v1.1 was released, a patch was offered that implements my proposed solution. I expect this patch (or something like it) will be in v1.2. However, that said... > Second, what do you use for a data backup and recovery scheme for your > Django data? I'm unclear why normal MySQL backup tools aren't the obvious first solution here. Yes, Django does provide data dumping and loading tools, but they are primarily designed for small fixtures for tests and initial database setup. I'm not saying that loaddata and dumpdata _can't_ be used on large data sets, when you're talking about backing up the entire database, the database is going to be able to provide much better tools than Django will. Trying to build a backup and recovery system without using the tools closest to the data seems like a lot of extra work to me. You also appear to be conflating two separate problems. Talking about the fragility of fixtures when the database changes isn't a problem specific to fixtures - any data dumping scheme will experience the same problems. Some data loading schemes might be more robust to simple changes, but for anything other than trivial changes, you're going to need a much more sophisticated approach than "dump the data and reload it". This is a schema evolution issue, not a backup issue. Yours, Russ Magee %_) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: question about admin.py list_display
Solved over at http://stackoverflow.com/questions/1378447/question-about-admin-py-listdisplay On Sep 4, 11:28 am, "Rob B (uk)"wrote: > http://dpaste.com/89435/ > > I'm trying to show game.status in GameListAdmin's list_display but not > sure how to do a backwards lookup using the ForeignKey in Admin.py > > See link for details. > > Any ideas? --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
question about admin.py list_display
http://dpaste.com/89435/ I'm trying to show game.status in GameListAdmin's list_display but not sure how to do a backwards lookup using the ForeignKey in Admin.py See link for details. Any ideas? --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Zip multiple files into a zipped folder for download?
Hi all, I've got an advanced question. How do i create a zip file that contain multiple files and folders in the zip file? For example, within the zip it contains: folder.zip -> file1.php -> file2.php -> file3.html -> folder ---> fileInFolder1.css ---> fileInFolder.html ---> fileInFolder.php And the zip file is available for download? Best Regards. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: are you using mptt, treebeard or something else?
On Sep 3, 5:51 pm, Sandra Djangowrote: > Sorry, a cuestion because I don't understand. mptt requires v1.1, but not > SVN version? only mptt svn trunk works with django 1.1 but i would like an official release rather then trunk. Aljosa --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problem with content type creation order and data recovery scheme
My goal here is to create a backup and recovery scheme, where recovery is possible on any computer. I've been performing incremental updates to an application that people have started to use. The incremental updates seem to have created a problem for the dump and load data functions when trying to reload into a fresh database. I tried to use dump data to create an __ initial __ .json file, but I received a duplication error on load, I think from the unique index (not the primary key) on the content type. I believe this is because the tables (and thus content types) are created in a different order when doing a syncdb from scratch, as opposed to incrementally on the old production machine. One possible solution is to create a DB without any of the application data, only with the Django meta data. Then I could just dump and load my application data afterward. The only issue with that is that I would really like to be able to save the admin log. My brute force solution to this looks like it will end up being to drop all the FKs pointing at content type, update the IDs in the content type table and all referencing tables to match a fresh syncdb, then recreate the FKs. This is definitely not the most elegant solution. I thought that dump data would work for a backup mechanism but it seems to break with application modifications (table additions) too easily. I see a real and an other potential problem here. Real: The manual operation to create content types in the correct order belies an automated process to do so. Potential: Even after the operation is done, the records seem to be dumped in random order in the json file. I'm not sure that after my operation they will be dumped in the same order. If they aren't then I believe I'm back to the same problem. >From where I stand it looks like the MySQL backup is going to be the way to go for me. Firstly, does anyone have a more elegant solution to the dump and load data problem specifically? Second, what do you use for a data backup and recovery scheme for your Django data? --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Using Django cache framework for object write-through caching?
Is there any way to get Django to support write-through caching of objects? For example say I have a blog object and I want to retrieve the attribute "body". Normally the ORM would generate a SQL query and get the data from the database. Is it possible to set it up so that the ORM would try the cache backend first and only go to the database as a last resort if there's a cache miss? Likewise if I update an object I'd want the ORM to either delete the old cached object or to update it. >From reading the doc I don't think this is supported by Django out of the box. Is there any pluggable apps or snippets that does this? Or would I need to do this manually every time I retrieve/update an object? --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Same application with different URLs
> strangely unreliable. When both sites are used, an Error 500: Internal > server error is frequently returned (but mere repeated reloading of > the same page eventually gives a correct page). What is the error 500? Is it the same error every time? Also, you have restarted apache? Different apache processes could be out of sync and running different django configs, thus giving different outcomes. -- Andrew McGregor 07940 22 33 11 --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to deploy an app that gets used by people in multiple time zones
On Thu, Sep 3, 2009 at 11:36 PM, Margie Roginskiwrote: > > I've created a django app and I soon am going to have users that are > in multiple timezones. My app is a task management system and it is > important for users to see dates and times with respect to their own > time zone. IE, if here in California I create a task at 3PM on Sept > 3, I want someone in India to see it as being created at 1AM on Sept > 4. Optimally, if that India employee travels to the US and looks at > the task creation date, they should see 3PM on Sept 3. Is there a > "best" way to handle this? Things that come to mind are: > > 1. Create a deployment for each of my time zones where TIME_ZONE and > DATE_FORMAT are set appropriately for the time zone associated with > the deployment. This seems painful ... > > 2. Have a single deployment and whenever I display dates, use some > sort of tag that can figure out how to display the date correctly > based on the user's time zone > > 3. I see there is a reusable app called django-timezones. There is > not much doc with it, but I'm guessing this is targeted at what I am > trying to do. > > Can anyone give any recommendations? I'm happy to dive in and read > source (ie, for django-timezones app), but I just want to make sure > I'm heading in the right direction. > > Thanks, have you tried to use postgres timestamp with time zone field? It has ability to make such a conversion on the fly and every date can be stored with timezone --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how to retrieve the message model fields from usr object
Hi, I am trying to retrieve the few cols from auth_user & auth_message table. Here is the statement that i am using User.objects.filter(username=10).values('username', 'message_user_id', 'message_message') and ended up with the below error >>> User.objects.filter(username=10).values('username', 'message_user_id', >>> 'message_message') Traceback (most recent call last): File "", line 1, in File "c:\Python25\lib\site-packages\django\db\models\query.py", line 452, in values return self._clone(klass=ValuesQuerySet, setup=True, _fields=fields) File "c:\Python25\lib\site-packages\django\db\models\query.py", line 681, in _clone c._setup_query() File "c:\Python25\lib\site-packages\django\db\models\query.py", line 799, in _setup_query self.query.add_fields(self.field_names, False) File "c:\Python25\lib\site-packages\django\db\models\sql\query.py", line 2059, in add_fields "Choices are: %s" % (name, ", ".join(names))) FieldError: Cannot resolve keyword 'message_user_id' into field. Choices are: date_joined, email, emailaddress, first_name, groups, id, is_active, is_staff, is_superuser, last_login, last_name, logentry, message, password, user_permissions, userbasicdetails, username FieldError showing the Choices - message How can i use that field in values for a query? Could some one please guide me in resolving the issue. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Same application with different URLs
Hello, I have a Django application that I need to appear on multiple Apache virtual hosts with different URLs (e.g. the same view would be accessible under http://one.site/view and under http://another.site/another/path/to/view). So far, I have tried to have multiple interpreter instances under mod_python, give each instance a different environment setting via SetEnv, and branch in urls.py like this: ServerName "one.site" SetEnv DJANGO_URL_SITE_ONE ... ... ServerName "another.site" SetEnv DJANGO_URL_SITE_TWO ... ... urls.py: if "DJANGO_URL_SITE_ONE" in os.environ: urlpatterns = ... # Patterns for one.site if "DJANGO_URL_SITE_TWO" in os.environ: urlpatterns = ... # Patterns for another.site The approach seems to work somewhat (both sites are visible on the appropriate URLs), but after doing this, the application itself became strangely unreliable. When both sites are used, an Error 500: Internal server error is frequently returned (but mere repeated reloading of the same page eventually gives a correct page). Before I go off on hunting the bug somewhere in the application (which used to work fine before), my question is: is this approach (that is, having multiple interpreters running multiple instances of the same application from the same directories, accessing the same database) something that should work ? Thanks, Petr --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---