Re: Using a non-DB backend

2010-10-15 Thread Sam Lai
On 16 October 2010 00:21, Damir Dezeljin wrote: > Hi. > I'm working on an application tat communicates with embedded devices > connected to the LAN. The devices are controlled by a central server written > in C++. Django is used for the front-end or better to say the GUI

Re: mysql and Django

2010-10-15 Thread David
I think there is some confusion here. I'm guessing you are using mysql- python v1.2.1 since a 1.x mysql version would probably date back to the mid to late 90s. Ask the admin if it is possible to upgrade mysql- python for which you do not need to upgrade MySQL itself or even take down the

Re: modelformset_factory, initial, and queryset

2010-10-15 Thread Tim Valenta
I have a model like such: class Response(models.Model): raw_text = models.TextField() respondent = models.ForeignKey('auth.User') Response has a related model attached to it: class Code(models.Model): response = models.ForeignKey(Response) coded_answer =

Re: use django authentication for non-django pages

2010-10-15 Thread clee
On Oct 15, 2:12 am, bowlby wrote: > We're hosting a small site on our own server. On the server we have > some pages that are non-django (for example munin to see server > statistics). Is there a way to use django's authentication mechanism > to reserve access to these pages

Re: iPhone posting FILEs = "Invalid content length"

2010-10-15 Thread Mike Krieger
Hey Eric! We're using ASI & Django and seeing the same thing. Was setting shouldAttemptPersistentConnection enough to make the problem go away? About 1/50 of our requests fail with this bug. Thanks! Mike On Oct 7, 11:21 am, Eric Chamberlain wrote: > We ran into the same error

mysql and Django

2010-10-15 Thread emma
Hi, the linux server of my company has mysql 1.2.1, which is too old for Django. However, the administrator didn't want to upgrade it. I have to install mysql 5.1.51 under my home directory. I did that successfully, but Django still complain about the older mysql. Do you know if there is a way to

How to get request.user when Django emails a 500 error report?

2010-10-15 Thread Margie Roginski
I finally turned off DEBUG on my site and got set up so that the django code would email me the exceptions. This is ultra-cool! So I got m first one in the mail today, and was hard-pressed to figure out the user that ran into the error. I don't find request.user anywhere in the report. Do I

PgWest 2010: Django + PostgreSQL Tutorial

2010-10-15 Thread Joshua D. Drake
Hello, For those who might be interested there are several PostgreSQL + Django talks happening at PgWest: https://www.postgresqlconference.org/content/django-and-postgresql https://www.postgresqlconference.org/content/speeding-django-and-other-python-apps-automatic-remoting-database-methods You

Re: MaxValueValidator to validate a model

2010-10-15 Thread refreegrata
Now works. validators=[MaxValueValidator(Decimal('14.5')) But I must to do an explicit declaration Decimal('14.5'). Somebody knows why? On 15 oct, 18:13, refreegrata wrote: > Hello list. I want to validate the data in a field of a model. > > with this >

MaxValueValidator to validate a model

2010-10-15 Thread refreegrata
Hello list. I want to validate the data in a field of a model. with this validators=[MaxValueValidator(14)] the field is correctly validated but with this validators=[MaxValueValidator(14.5)] always is invalid Somebody know how use the "MaxValueValidator" when the "max_value" is a decimal?

Re: Save Handlers and a newbie to Django

2010-10-15 Thread Devin M
Thanks everyone, I tried using some signal handlers but it wasn't happening so I reverted to the override of the save method and now I have it working. Regards, Devin Morin On Oct 15, 8:56 am, Blue Cuenca wrote: >  On 10/15/2010 9:01 PM, Devin M wrote:> Hello everyone, > >    

Re: Using a non-DB backend

2010-10-15 Thread Devin M
For more than one database it seems that you are able to do it http://docs.djangoproject.com/en/dev/topics/db/multi-db/. You could implement your device functions inside something like myproject.device.functions if your not working with alot of data. Or you can implement that in the database

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Marc Aymerich
On Fri, Oct 15, 2010 at 9:37 PM, Alec Shaner wrote: > doh! Just noticed that you already referenced ticket 10154 in your > original post. Well, I referenced the patch that I found searching with google, but actually I didn't saw the ticket that it belongs to ;) On the

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Alec Shaner
doh! Just noticed that you already referenced ticket 10154 in your original post. On Fri, Oct 15, 2010 at 3:16 PM, Alec Shaner wrote: > Interesting solution - after all that maybe it's more concise to just > use the 'extra' filter instead since you're making it specific to

Re: Using a non-DB backend

2010-10-15 Thread Damir Dezeljin
Thanks. I read the docs you pointed med to and now I have few more questions: 1. Is it possible to use two or more different back-ends with a single Django project? For me it seems not. 2. After rethinking my needs I realized I need simple functions as e.g. FlushDevice(), GetServerUptime(),

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Alec Shaner
Interesting solution - after all that maybe it's more concise to just use the 'extra' filter instead since you're making it specific to mysql anyway, and you could use mysql date functions. By the way, in answer to your original question on this thread, there already is a ticket to add F() +

Re: Legacy database with a table, which has no separate primary key

2010-10-15 Thread Alexander
Thank you for such a comprehensive answer. I chose to add the field to the table. It seems to be the best solution. -- 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

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Marc Aymerich
On Fri, Oct 15, 2010 at 7:54 PM, Alec Shaner wrote: > On Fri, Oct 15, 2010 at 1:26 PM, Marc Aymerich > wrote: > > > > Instead of use datatime.timedelta I convert it to string with this > format: > > MMDDHHMMSS and now all works fine with mysql :)

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Alec Shaner
On Fri, Oct 15, 2010 at 1:26 PM, Marc Aymerich wrote: > > Instead of use datatime.timedelta I convert it to string with this format: >  MMDDHHMMSS and now all works fine with mysql :) Unfortunately this part > of code doesn't be database independent :( > > Thank you very

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Marc Aymerich
On Fri, Oct 15, 2010 at 5:02 PM, Alec Shaner wrote: > It should be clarified that this occurs on the mysql backend, but not > the postgres backend. It has to do with how MySQL handles the DATETIME > object. You can't add a timedelta, because it expects a double. > > I

Re: python highlighting in text input field

2010-10-15 Thread pixelcowboy
Yep, thats it man! That is great, thanks! On Oct 14, 11:01 pm, Antoni Aloy wrote: > http://www.cdolivet.com/index.php?page=editArea=106bb5f73b60725d... > > This a javascript code editor. Perhaphs it would give you another 40% > > 2010/10/15 pixelcowboy

Changing the Language does not work with Internet Explorer

2010-10-15 Thread Thomas Neumeier
Hi, I've got a django site which uses the built in view to change the users language: urls.py: (r'^i18n/', include('django.conf.urls.i18n')), template: {% csrf_token %} {% for lang in LANGUAGES %} {% ifequal lang.0 "de" %}

Re: Legacy database with a table, which has no separate primary key

2010-10-15 Thread David De La Harpe Golden
On 15/10/10 12:15, Alexander wrote: > As you can see the 'rating' table has no separate primary key field. Yeah, that is pretty commonplace (though not presently supported by django), the natural primary key for a table may be composite... > Here are the models created by Django with some my

Re: Legacy database with a table, which has no separate primary key

2010-10-15 Thread Alexander
Thanks for your reply. -- 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 django-users+unsubscr...@googlegroups.com. For more

Re: Save Handlers and a newbie to Django

2010-10-15 Thread Blue Cuenca
On 10/15/2010 9:01 PM, Devin M wrote: > Hello everyone, > I am writing a save handler in my models.py file to run a few > actions after a save. to do this I have a function called make_photos > and a connection to the post_save signal. > Here is my code: > > > The only problem i have with

Re: fields in inner join

2010-10-15 Thread refreegrata
ok, thank for reply. I think that with this query: " AA.object.filter(...).select_related( field related in BB ) " The impact in the performance is minimun But with this query " AA.object.filter(...).select_related() " the impact is higher, because the first query do an unique "join", but

multi-database and south

2010-10-15 Thread Heigler
Hi, I'm working on a project that uses 2 databases. I wrote a route for my special database, that route should allow just some tables for syncdb, and it works very well when i use ./manage.py syncdb -- database=my_other_db, however, i got some troubles with south, it seems not respect my route,

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Marc Aymerich
On Fri, Oct 15, 2010 at 5:02 PM, Alec Shaner wrote: > It should be clarified that this occurs on the mysql backend, but not > the postgres backend. It has to do with how MySQL handles the DATETIME > object. You can't add a timedelta, because it expects a double. > > I

Re: fields in inner join

2010-10-15 Thread Daniel Roseman
On Oct 15, 4:19 pm, refreegrata wrote: > Hello, how can i get fields from different tables related for a > foreign key? > > When I do a inner join like > > AA.objects.filter(bb__field = ...) ... > > I just can access to the AA fields, and not to fields in the other > table

Re: Are AutoField primary keys re-used after deleting an object from the db?

2010-10-15 Thread Dirk
FYI: SQLite3 indeed re-uses primary keys if they are deleted from the tail of the sequence. (So I'll have to use a UUID as a permanent id.) Thanks for your support. Dirk On Oct 10, 5:57 am, Russell Keith-Magee wrote: > On Sunday, October 10,

fields in inner join

2010-10-15 Thread refreegrata
Hello, how can i get fields from different tables related for a foreign key? When I do a inner join like AA.objects.filter(bb__field = ...) ... I just can access to the AA fields, and not to fields in the other table in a normal query i can do something like "select AA.*, BB.* FROM. AA inner

Re: Save Handlers and a newbie to Django

2010-10-15 Thread Devin M
Im just storing these files in standard ImageFields does the field take care of that automagically? And whats the best way to delete the files saved to tmp? should i do a system call for rm? On Oct 15, 7:41?am, Jonathan Barratt wrote: > On 15 ?.?. 2010, at 21:35,

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Alec Shaner
It should be clarified that this occurs on the mysql backend, but not the postgres backend. It has to do with how MySQL handles the DATETIME object. You can't add a timedelta, because it expects a double. I created a test app using a mysql backend and a Article model with created and updated

Re: Save Handlers and a newbie to Django

2010-10-15 Thread Jonathan Barratt
On 15 ?.?. 2010, at 21:35, Devin M wrote: > Ok its running in a infinite loop because im calling > self.*photo.save() and that starts this loop all over again. Maybe I > can add a field to the model like booleen resized and if its true dont > do any resizing but if its false then perform some

Re: Save Handlers and a newbie to Django

2010-10-15 Thread Jonathan Barratt
On 15 ?.?. 2010, at 20:01, Devin M wrote: > Hello everyone, >I am writing a save handler in my models.py file to run a few > actions after a save. to do this I have a function called make_photos > and a connection to the post_save signal. > Here is my code: > > The only problem i have with

Re: Save Handlers and a newbie to Django

2010-10-15 Thread Devin M
Ok its running in a infinite loop because im calling self.*photo.save() and that starts this loop all over again. Maybe I can add a field to the model like booleen resized and if its true dont do any resizing but if its false then perform some resizing(aka run the function)? also im going to have

Re: Pagination with bound form

2010-10-15 Thread Devin M
Wait looks like i made an error. http://testsite.com/page/{%pk - 1%}>Previous Page and you might not be able to use pk so see if you can use data.pk let me know if it works. Regards, Devin M On Oct 15, 6:56 am, Devin M wrote: > Oh you want just one record per page? Thats

Re: Pagination with bound form

2010-10-15 Thread Devin M
Oh you want just one record per page? Thats easy. urls.py (r'^page/(?P\d+)/$', 'data.views.pagelisting'), views.py def pagelisting(request, page_number): data_list = Data.objects.filter(pk=page_number) return render_to_response('list.html', {"data_list": data_list}) template list.html {%

Re: Pagination with bound form

2010-10-15 Thread David
Hi Devin Thank you for your reply. I'm not sure if I've explained myself properly, or if I'm misinterpreting your reply. What I am aiming for is a form containing a single record. At the bottom of this form will be the pagination tools << Prev 1 2 3 etc. which will enable the user to navigate

Re: use django authentication for non-django pages

2010-10-15 Thread Devin M
You could use a template in django if your only serving some static html. Otherwise if its php or something, make a template and restrict it to admin and have the view render the php and spit it out to the page context. On Oct 15, 2:12 am, bowlby wrote: > We're hosting a

Re: Using a non-DB backend

2010-10-15 Thread Devin M
Hello, It looks like you want a custom database backend. On http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#engine they say "You can use a database backend that doesn't ship with Django by setting ENGINE to a fully-qualified path (i.e. mypackage.backends.whatever). Writing a whole

Re: Legacy database with a table, which has no separate primary key

2010-10-15 Thread Devin M
Wait... I just looked at your sql and it looks like you would need to use multiple-column primary keys which are unsupported by django. http://code.djangoproject.com/ticket/373 On Oct 15, 4:15 am, Alexander wrote: > I have a database, which among others has the following

Re: Help with Manager.

2010-10-15 Thread Alec Shaner
Sorry, not sure about that warning because I'm using a postgresql database. On Fri, Oct 15, 2010 at 3:17 AM, Marc Aymerich wrote: > > > On Fri, Oct 15, 2010 at 3:39 AM, Alec Shaner wrote: >> >> You can't add a datetime to another datetime - you want

Re: Legacy database with a table, which has no separate primary key

2010-10-15 Thread Devin M
I did some quck googling and found this. http://stackoverflow.com/questions/605896/django-querying-read-only-view-with-no-primary-key This is the response from them that seems most helpful. "all you need is a column that is guaranteed to be unique for every row. Set that to be 'primary_key =

Using a non-DB backend

2010-10-15 Thread Damir Dezeljin
Hi. I'm working on an application tat communicates with embedded devices connected to the LAN. The devices are controlled by a central server written in C++. Django is used for the front-end or better to say the GUI for the server. Part of the data the user needs access too are stored in the

Re: Pagination with bound form

2010-10-15 Thread Devin M
So you have a page number thats getting passed from a url, right? and then you want to display records based on that page number? you could do something like this: urls.py (r'^page/(?P\d+)/$', 'data.views.pagelisting'), views.py def pagelisting(request, page_number): records =

Save Handlers and a newbie to Django

2010-10-15 Thread Devin M
Hello everyone, I am writing a save handler in my models.py file to run a few actions after a save. to do this I have a function called make_photos and a connection to the post_save signal. Here is my code: class Album(models.Model): title = models.CharField(max_length=200) date =

Pagination with bound form

2010-10-15 Thread David
Hello I need to be able to create a form that contains data from my database. It also needs to have basic pagination at the bottom of the form as there will be many records, and I would like my users to be able to use pagination to access them (kind of like MS Access). I can produce the form ok,

Re: Hosting many small Django websites

2010-10-15 Thread Venkatraman S
On Fri, Oct 15, 2010 at 5:26 PM, Brian Bouterse wrote: > One of the challenges of going the GAE route is that you need to modify > your application slightly to work with their version of models. Also, you > can't ever run this code off of GAE, so it's kind of a lock-in in

Re: Hosting many small Django websites

2010-10-15 Thread Brian Bouterse
One of the challenges of going the GAE route is that you need to modify your application slightly to work with their version of models. Also, you can't ever run this code off of GAE, so it's kind of a lock-in in that respect. That being said it does work very well. Brian On Thu, Oct 14, 2010

Legacy database with a table, which has no separate primary key

2010-10-15 Thread Alexander
I have a database, which among others has the following tables: CREATE TABLE users ( userId BIGINT PRIMARY KEY ); CREATE TABLE movies ( movieId BIGINT PRIMARY KEY, title varchar(255) NOT NULL ); CREATE TABLE ratings ( userId BIGINT NOT NULL REFERENCES users(userId), movieId BIGINT NOT

F() and timedelta. Bug on django?

2010-10-15 Thread Marc Aymerich
This is a fork of this tread: http://groups.google.com/group/django-users/browse_thread/thread/5c6beb41fcf961a4 I'm getting troubles combining instances of F() and timedelta. I'm working with the very last trunk revision (14232), I create a very simple model for troubleshoting the problem, the

Re: I18n in Django model

2010-10-15 Thread Kenneth Gonsalves
On Thu, 2010-10-14 at 23:03 -0700, BlackMoses wrote: > First table contains universal field which doesn't depends on > language. Second contains fields that suposed to be in many languages, > 'culture' field which store language code ('en', 'de' etc). Both > tables are related with foreign keys of

use django authentication for non-django pages

2010-10-15 Thread bowlby
We're hosting a small site on our own server. On the server we have some pages that are non-django (for example munin to see server statistics). Is there a way to use django's authentication mechanism to reserve access to these pages to users who have an account? Details: we have site say,

Re: I18n in Django model

2010-10-15 Thread Jonathan Barratt
On 15 ?.?. 2010, at 13:03, BlackMoses wrote: > have question if Django have support for I18n models. > > My question is if there are any Django standards/tools that i should > use for it? Or I have to take care with it on my own. Yes there are standard tools, please see:

Re: MySQL locking problem

2010-10-15 Thread Tom Evans
SHOW FULL PROCESSLIST; EXPLAIN ; On Thu, Oct 14, 2010 at 6:02 PM, Nick Arnett wrote: > I am having a problem with locking on MySQL and can't quite figure out > what's causing it.  Although I have some scripts that do raw SQL, none of > them are running, I see no other

I18n in Django model

2010-10-15 Thread BlackMoses
have question if Django have support for I18n models. For example in Symfony when i create 'news' table there are 2 tables in fact : news id date news_i18n id culture title text First table contains universal field which doesn't depends on language. Second contains fields that

Re: Help with Manager.

2010-10-15 Thread Marc Aymerich
On Fri, Oct 15, 2010 at 3:39 AM, Alec Shaner wrote: > You can't add a datetime to another datetime - you want to add a > datetime.timedelta instance instead. Out of curiosity I just tested it > on one of my models and it does work, e.g., > >

Re: python highlighting in text input field

2010-10-15 Thread Antoni Aloy
http://www.cdolivet.com/index.php?page=editArea=106bb5f73b60725d9a1657c4b0e42ca4 This a javascript code editor. Perhaphs it would give you another 40% 2010/10/15 pixelcowboy : > Thanks, I guess this gets me halfway there! Still need to figure out > the highlighting for