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 help
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
http://source.mihelac.org/x/treetable/
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 category_pa
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 category_parent.l
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 in this case, but
> at least
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 whi
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 OneToOneField raises
>> > DoesNotExist instead of returni
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 met
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 conne
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 an
> dummy "index.html" so t
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 a
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):
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
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 str(uuid
> 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 project
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 are subscribed to the
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
---
> 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 dependenci
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
>
>
>
>
>
> > Hey all,
>
> > I'm a little co
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 like:
>
> create view category_
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 as
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 = "found")
> works just fine.
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 get_upload_path(instance, filename
Can anyone give me any suggestions for a relatively simple, pluggable
Q&A 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 o
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 wh
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 "some_
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,
>>>
Is there a particular reason why using a relat
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 the only issue with
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:
User.objects
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
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.
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
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 that you can't just
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 à 16:47, Ozgur Yılmaz a éc
> 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 well
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
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 and
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 Python Database framework,
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
> (http://pypi.python.org/pypi/dj
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
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
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 you want to use a differ
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 import signals
> fr
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
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 Django
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)
cre
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 changed after I got it.
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
> ID",primary_key=True)
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 t
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
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.
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 in range(128)
>
> for so
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 NoAr
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
> have written, but I'm
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 ap
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.
>
>
>
> On Fri, May
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 = models.Fore
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
> ...
>
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
> ...
>
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 somew
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, mendes.rich...@gmail
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:
> Hello
> Le 14 mai 2010 à
62 matches
Mail list logo