Re: Python Database Framework

2010-05-14 Thread Joshua Partogi
Thanks Nabil, I am also looking for something that is as simple as Django ORM but a standalone ORM that is not tightly coupled. I also like the ActiveRecord's syntax of Elixir. Kind regards, Joshua -- http://twitter.com/scrum8 On May 14, 7:51 am, Nabil Servais wrote:

Re: django version 1.1.1 decimalfield invalidoperation

2010-05-14 Thread mendes.rich...@gmail.com
Ok, thanks a lot for your help Apparently I misunderstood that part, and indeed I replaced it to 20 and 15 leaving again 5 digits. It should do the trick i'll change it asap. Thanks again. Richard On May 14, 7:38 pm, Karen Tracey wrote: > On Fri, May 14, 2010 at 8:22 AM,

Re: Python Database Framework

2010-05-14 Thread Ozgur Yılmaz
Now I'm stuck... As you guys pointed to me, I've searched the web for DJANGO_SETTINGS_MODULE and found that I can use django.conf.settings to set the settings and that allowed me to use django in standalone scripts. To be more clear I use: from django.conf import settings then in the code

Re: object is not iterable.

2010-05-14 Thread Gonzalo Delgado
El 14/05/10 18:00, Niels escribió: > In my template this error occurs: > > Caught an exception while rendering: 'Gallery' object is not iterable > > It occurs in this part: > {% for image in car.images %} > > > Where my models looks like: > > from photologue.models import Gallery,Photo > ...

Re: object is not iterable.

2010-05-14 Thread Gonzalo Delgado
El 14/05/10 18:00, Niels escribió: > In my template this error occurs: > > Caught an exception while rendering: 'Gallery' object is not iterable > > It occurs in this part: > {% for image in car.images %} > > > Where my models looks like: > > from photologue.models import Gallery,Photo > ...

object is not iterable.

2010-05-14 Thread Niels
In my template this error occurs: Caught an exception while rendering: 'Gallery' object is not iterable It occurs in this part: {% for image in car.images %} Where my models looks like: from photologue.models import Gallery,Photo ... class CarDetail(models.Model): images =

Re: Using extra() to add table alias

2010-05-14 Thread Austin Gabel
I just found out that I could use join() for this instead. .query.join((None, 'category', None, None)) This got me what I wanted. On Fri, May 14, 2010 at 8:06 AM, Austin Gabel wrote: > Well, yeah that would work but I would really hate to use a view to work > around this. >

Re: SCORM(Sharable Content Object Reference Model) Compliant for Django?

2010-05-14 Thread rleathers
My company has built PowerU, an LCMS with SCORM player, video on demand, automatic notifications, a deep authorization system, classroom management, instructor management, and many more features. We use Adobe Flex with PyAMF and Django with a PostgreSQL back end. It is essentially a giant django

Re: Testing custom management commands

2010-05-14 Thread ses1984
If I could add, in my tests, I was testing to see whether the command executed successfully and I was inspecting the state of the database after the command executed. On May 14, 3:04 pm, ses1984 wrote: > I am interested in writing unit tests to cover some custom commands I >

Testing custom management commands

2010-05-14 Thread ses1984
I am interested in writing unit tests to cover some custom commands I have written, but I'm unsure how I can pass options to these commands through my unittest.TestCase classes. I have a command to import data from my client's flat file system into Django models, which originally existed as a

Re: Django CSV module encoding issue

2010-05-14 Thread Karen Tracey
On Fri, May 14, 2010 at 2:34 PM, zweb wrote: > I am using DJango CSV module and doing writerrow() on some text data > generated through tinyce text editor. > > I am getting following error > > ascii' codec can't encode character u'\\u2019' in position 337: > ordinal not

Re: Django CSV module encoding issue

2010-05-14 Thread Bill Freeman
Two choices: 1. Use apostrophe instead of a left or right signle quote when filling out the form. ;^) 2. Encode the description as utf-8 before writing it. description is almost certainly a unicode string. It gets coerced to be a bytes string when passed to python's (not django's) csv writer.

Django CSV module encoding issue

2010-05-14 Thread zweb
I am using DJango CSV module and doing writerrow() on some text data generated through tinyce text editor. I am getting following error ascii' codec can't encode character u'\\u2019' in position 337: ordinal not in range(128) for some reason it cannot handle the single quote in text. How do I

Re: m2m_changed doesnt work

2010-05-14 Thread imgrey
Thanks a lot! -- 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 options, visit

Re: django version 1.1.1 decimalfield invalidoperation

2010-05-14 Thread Karen Tracey
On Fri, May 14, 2010 at 8:22 AM, mendes.rich...@gmail.com < mendes...@gmail.com> wrote: > [snip] > > The problem i'm having is with the following model class with the > field value: > > class Measurement(models.Model): >measurement_id = models.AutoField("Measurement >

Re: How to reload an object's member field?

2010-05-14 Thread Steve Bywater
I needed to do something similar just yesterday, and did it the same way you discovered. I agree, kinda weird: foo = Foo.objects.get(foo.id) On May 13, 12:25 pm, Chia Hao Lo wrote: > I have a model Foo. If I've got a model instance foo, and I know that > foo.value may be

Re: Pluggable Q app?

2010-05-14 Thread Nick
I actually just got done writing a QandA app. It's very basic. I don't have it open yet but I would turn over the source to you if you wanted. Here are the features: Question Answer Answerer Answerer's credentials site specific QandA (using django.contrib sites) tagging (using django-tagging)

Re: HttpResponseRedirect(request.path) after request.POST issue

2010-05-14 Thread marty3d
I finally went half and half here, by posting to an /vote// url. Personally, I think handling the GET in the tag and the POST in a view is a bit messy, but perhaps I find a better solution later. After I got that to work properly, I also implemented an ajax version. I have never done that in

Re: M2M with Intermediary - Django Admin Support - Doesn't appear?

2010-05-14 Thread Nuno Maltez
Hmmm ... you should have an inline formset at the bottom to add firms to your Article, with an associated input box forthe rating. If I understand correctly, each relation Article-Firm now needs a rating (mandatory), sou you can't just select Firms from a filter_horizontal widget - you need a way

Re: m2m_changed doesnt work

2010-05-14 Thread Karen Tracey
On Fri, May 14, 2010 at 8:19 AM, imgrey wrote: > Good Day > > Im trying to create machanism for tracking changes in model's > ManyToMany fields. For some reason django connects signals, but wont > execute callback: > > """ > from django.db import models > from django.db.models

Re: Using a variable for a field name in a filter?

2010-05-14 Thread Javier Guerra Giraldez
On Fri, May 14, 2010 at 8:37 AM, Nuno Maltez wrote: > Sure: > http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists > > myfilter = { var_field: "found" } > Foo.objects.filter(**myfilter} or even: Foo.objects.filter (**{var_field+'__eq':'found'}) if

Re: Python Database Framework

2010-05-14 Thread Masklinn
On 2010-05-14, at 17:21 , Tom Evans wrote: > > Alternatively, all django needs to run is the import location of the > settings module [2]. Set it in DJANGO_SETTINGS_MODULE, and then you > can just write standard python scripts, importing django bits as > needed. There are also hacks which let you

Re: Python Database Framework

2010-05-14 Thread Shawn Milochik
There's SQLAlchemy, but it's not nearly as simple as the Django ORM. However, nobody's stopping you from using the Django ORM (or the templates) in other projects that don't use the rest of Django. You will have to make a minimum settings.py or make certain values available in the scope of your

Re: Python Database Framework

2010-05-14 Thread Tom Evans
On Fri, May 14, 2010 at 4:12 PM, Ozgur Yılmaz wrote: > thanks guys for being that fast... > > Elixir seems what I'm looking for... > > Russel: I've tried to figure out how to use the Djanog-ORM, but I couldn't > find any good way other than using Djanog-Standalone >

Re: Python Database Framework

2010-05-14 Thread thanos
Django is great and I've writing quite a lot with it but my projects need dynamic multiple database connections. Now with 1.2 I might do things differently. But I would miss elixir.ext.versioned ! thanos On May 14, 11:07 am, Jirka Vejrazka wrote: > > Do anyone knows a

Delete cache item when model changes

2010-05-14 Thread Torsten Bronger
Hallöchen! I'd like to clean up the cache when an updated model instance is saved to the database backend. Let's assume that I have a model "Person", and the user can view the person's information on a webpage. However, much data must be collected for this webpage, so it's a costly operation

Re: Python Database Framework

2010-05-14 Thread Ozgur Yılmaz
thanks guys for being that fast... Elixir seems what I'm looking for... Russel: I've tried to figure out how to use the Djanog-ORM, but I couldn't find any good way other than using Djanog-Standalone ( http://pypi.python.org/pypi/django-standalone/0.4) and it has some side effects. And I like to

Re: Python Database Framework

2010-05-14 Thread Jirka Vejrazka
> Do anyone knows a Python Database framework, which resembles Django's > approach to database programming? I need it to use outside of Django, for > other Python scripts. Any reason why you wouldn't Django itself? I do use the ORM to multiple projects that have no relation to web. Works very

Re: Python Database Framework

2010-05-14 Thread thanos
Elixir gets my vote. I now always use http://www.sqlalchemy.org/ for any db work. But Elixir is cool. I used it with http://elixir.ematia.de/apidocs07/elixir.ext.versioned.html and it saved my bacon ! On May 14, 10:51 am, Nabil Servais wrote: > Hello > Le 14 mai 2010

Re: Python Database Framework

2010-05-14 Thread Russell Keith-Magee
On Fri, May 14, 2010 at 10:47 PM, Ozgur Yılmaz wrote: > Hi everybody, > > Do anyone knows a Python Database framework, which resembles Django's > approach to database programming? I need it to use outside of Django, for > other Python scripts. Is there some fundamental reason

Re: Python Database Framework

2010-05-14 Thread Masklinn
On 2010-05-14, at 16:47 , Ozgur Yılmaz wrote: > > Hi everybody, > > Do anyone knows a Python Database framework, which resembles Django's > approach to database programming? I need it to use outside of Django, for > other Python scripts. Well you could use Django itself, there are a few quirks

Re: Python Database Framework

2010-05-14 Thread Nabil Servais
Hello Le 14 mai 2010 à 16:47, Ozgur Yılmaz a écrit : > Hi everybody, > > Do anyone knows a Python Database framework, which resembles Django's > approach to database programming? Yes, Elixir : http://elixir.ematia.de/trac/wiki. > I need it to use outside of Django, for other Python scripts.

Python Database Framework

2010-05-14 Thread Ozgur Yılmaz
Hi everybody, Do anyone knows a Python Database framework, which resembles Django's approach to database programming? I need it to use outside of Django, for other Python scripts. Best regards, E.Ozgur Yilmaz Lead Technical Director www.ozgurfx.com -- You received this message because you are

Re: Update Query

2010-05-14 Thread Bill Freeman
Cool. So I guess we have a doc bug against the queryset API reference. Sim, if you're still reading this, and updating stuff in the database is what you were trying to do, then turn you computes collection of changes into a dictionary (if it isn't one already), "d" below, and do:

Re: Update Query

2010-05-14 Thread Tom Evans
On Fri, May 14, 2010 at 3:26 PM, Bill Freeman wrote: > Actually, there would be a real advantage to doing update in the > DB rather than instantiating the model, changing it, and saving it, > since sql update is a single transaction.  If that's what queryset > update does, then

Re: OneToOneField usage

2010-05-14 Thread Peter Herndon
On May 14, 2010, at 5:43 AM, Tom Evans wrote: > On Thu, May 13, 2010 at 7:31 PM, Daniel Roseman wrote: >> >> >> On May 13, 5:35 pm, Peter Herndon wrote: >>> On May 13, 2010, at 10:29 AM, TallFurryMan wrote: >>> Hello Django users, >>>

Re: Update Query

2010-05-14 Thread Bill Freeman
Actually, there would be a real advantage to doing update in the DB rather than instantiating the model, changing it, and saving it, since sql update is a single transaction. If that's what queryset update does, then the only issue with your version is that you needed two asterisks, passing

Re: Tree view me

2010-05-14 Thread Peter Herndon
On May 14, 2010, at 4:16 AM, cyrux cyrux wrote: > I have a simple task to accomplish. I have some hierarchal data in my > database which needs to be displayed in a UI. It needs to be simple > and preferably in a expandable tree format (although a non -expandable > should work as well). This is

Pluggable Q app?

2010-05-14 Thread bax...@gretschpages.com
Can anyone give me any suggestions for a relatively simple, pluggable Q app? I'm looking for something sorta Stack-Overflow-ish, but I'm OK with handling voting, authentication, search, etc. separately. What I've found so far (OSQA, Askbot, soclone) are far from pluggable. I don't want a whole

Re: Is it ok to super/save() twice in model.save()?

2010-05-14 Thread Richard Colley
Thanks Scott, that's more or less what we've finalised on. Appreciate your feedback! Richard On May 14, 10:28 pm, zinckiwi wrote: > Righto -- unfortunately that's the best solution I've come up with to > date. Here's the detailed version: > > # models.py > def

Re: Using a variable for a field name in a filter?

2010-05-14 Thread Nuno Maltez
Sure: http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists myfilter = { var_field: "found" } Foo.objects.filter(**myfilter} hth, Nuno On Fri, May 14, 2010 at 2:19 PM, derek wrote: > Given a model Foo, with a field bar: > Foo.objects.filter(bar =

Using a variable for a field name in a filter?

2010-05-14 Thread derek
Given a model Foo, with a field bar: Foo.objects.filter(bar = "found") works just fine. But, in my case, different fields are needed at different times, so I would like to use: Foo.objects.filter(var_field = "found") where "var_field" is a variable which will be set to the name of a field (such

Re: Using extra() to add table alias

2010-05-14 Thread Austin Gabel
Well, yeah that would work but I would really hate to use a view to work around this. On Fri, May 14, 2010 at 3:25 AM, michael luger wrote: > > this might be a django bug . > > a workaround using a view for the second usage worked for me . in your > case something

Re: Upload code from development server to local server

2010-05-14 Thread Archidjango
Alright, thanks for your input! I must admit I didn't read it yet (**embarrassed look to the ground**). I'll do that and if I still have problems, I'll come back to you ;-) Cheers, On May 14, 1:40 pm, Alessandro Pasotti wrote: > 2010/5/14 Archidjango

Re: Django Project & App Structure

2010-05-14 Thread zinckiwi
> Voila, I now have created an app that is independent of it's > surrounding project.  The only thing left is the fact that my app has > templates, which I understand is a no-no when making reusable apps. > I'll start working on that later, as I'm satisfied now with no strict > backwards

Re: Django Project & App Structure

2010-05-14 Thread ryan west
Hey Scott, thanks for the reply! I just figured that out the hard way actually, but I appreciate your response. My new directory structure now looks like: /home/website/djangoprojects/mydjangoproject/ --- / manage.py

Re: Update Query

2010-05-14 Thread zinckiwi
On May 13, 6:48 pm, Bill Freeman wrote: > Or you could be right.  I'm still not clear on the OP's intent. I suspect both would work, with my solution relying on a queryset containing a single object. Yours is cleaner! Regards Scott -- You received this message because you

Re: Django Project & App Structure

2010-05-14 Thread zinckiwi
> When I try to run syncdb, manage.py returns an error saying that my > app (djangoapp) could not be found.  I've tried to add the URL of the > app to the system path so that it would be accessible from external > directories - to do this I've tried adding the absolute URL of my app > to my

Re: Is it ok to super/save() twice in model.save()?

2010-05-14 Thread zinckiwi
Righto -- unfortunately that's the best solution I've come up with to date. Here's the detailed version: # models.py def get_upload_path(instance, filename): return "%s/%s/%s" % (instance.__class__.__name__.lower(), instance.uuid, filename,) def get_uuid(): import uuid return

Re: django version 1.1.1 decimalfield invalidoperation

2010-05-14 Thread mendes.rich...@gmail.com
Hello Karen, Thanks for your reply, i checked the code from the ticket and it was indeed already changed in the current version. The specs of the system i',m using are; Python 2.4.3 Django 1.1.1 final Database Postgresql Interface postgresql_psycopg2 The problem i'm having is with the following

m2m_changed doesnt work

2010-05-14 Thread imgrey
Good Day Im trying to create machanism for tracking changes in model's ManyToMany fields. For some reason django connects signals, but wont execute callback: """ from django.db import models from django.db.models import signals from django.db.models.base import ModelBase def add_signals(cls):

Override widget for one specific field in admin change_list page

2010-05-14 Thread Massimiliano della Rovere
I'm trying to override the widget used in the changelist page for one field of a model. The field is updated by an external daemon and is defined as: ping_status = models.CharField(blank=True, max_length=1, editable=False) The field will contains one letter: G = OK, R = KO, O = Suspect I created

Re: Upload code from development server to local server

2010-05-14 Thread Alessandro Pasotti
2010/5/14 Archidjango > Hey all, > > I'm a little confused, but I guess that's normal being a real > newbie :-) . > > I tried to upload code written on my development server to a "real" > web server. > > I uploaded the code through ftp and made the url-forward, tested

Upload code from development server to local server

2010-05-14 Thread Archidjango
Hey all, I'm a little confused, but I guess that's normal being a real newbie :-) . I tried to upload code written on my development server to a "real" web server. I uploaded the code through ftp and made the url-forward, tested an dummy "index.html" so there's no problem on that side. The

Admin (when saving): manipulating a parent field based on an inline object's field

2010-05-14 Thread TeenSpirit83
I have a Parent model having some Child objects edited as an inline in the change view of the Parent. I want to write some data in a Parent's field which is a calculation based on some other field of all its Child objects. I think i have to intercept child data in the save_model or save_formset

Re: OneToOneField usage

2010-05-14 Thread Tom Evans
On Thu, May 13, 2010 at 7:31 PM, Daniel Roseman wrote: > > > On May 13, 5:35 pm, Peter Herndon wrote: >> On May 13, 2010, at 10:29 AM, TallFurryMan wrote: >> >> > Hello Django users, >> >> > Is there a particular reason why using a related

I need help

2010-05-14 Thread Hussain Deikna
Hi, I plan to start writing my web page and I decide to use django and sqlite3 , my web page is very simple it is look like : 1- homepage a main page for public 'main page'. 2- user login and it will display special information to every to group of users 3- admen side. I need help in part 2

Re: HttpResponseRedirect(request.path) after request.POST issue

2010-05-14 Thread Tom Evans
On Thu, May 13, 2010 at 6:11 PM, marty3d wrote: > Thanks, that's a shame... > So I'm now trying to do the request.POST stuff in a view instead. > Since the idea is to have the voting app as decoupled as possible, is > there a slick way to pass, perhaps the whole object

Re: Using extra() to add table alias

2010-05-14 Thread michael luger
this might be a django bug . a workaround using a view for the second usage worked for me . in your case something like: create view category_parent as select * from category; category_list = Category.objects.all().extra(tables=['category_parent'], where=['category.lft BETWEEN

Re: Using extra() to add table alias

2010-05-14 Thread michael luger
this might be a django bug . a workaround using a view for the second table usage worked for me . in your case something like: create view category_parent as select * from category; category_list = Category.objects.all().extra(tables=['category_parent'], where=['category.lft BETWEEN

Tree view me

2010-05-14 Thread cyrux cyrux
I have a simple task to accomplish. I have some hierarchal data in my database which needs to be displayed in a UI. It needs to be simple and preferably in a expandable tree format (although a non -expandable should work as well). This is what I am looking for

Re: Multiple Database Simple Example

2010-05-14 Thread Jani Monoses
if model._meta.app_label == 'myapp' and model._meta.object_name == 'ModelInDatabase2Name': That is - instead of just checking the app, check the app and the model name. Install the router, and any query involving ModelInDatabase2Name will be directed to the 'other' database. It would be

Re: Generic web-dev question: Best way to do a processing page?

2010-05-14 Thread derek
On May 13, 9:19 pm, robotmurder wrote: > Usually when I do this for an upload, etc... it means that a user just > did something that resulted in an row being created in the db. I > usually keep a boolean field in the table for processing. Then when I > load the next page I

M2M with Intermediary - Django Admin Support - Doesn't appear?

2010-05-14 Thread Victor Hooi
heya, I have a Django app that keeps track of newspapers articles, and the companies mentioned in them (this is slightly simplified, but it' Each article has a m2m relationship with firm. Originally, this was just a direct m2m, however, I found I needed to add a "rating" to each firm that's