Hello,
I want to create a QuerySet object which select objects from a table
which a referenced by another table, but I can't find how to do that.
Here is an example :
class Article(models.Model):
[...]
class Photo(models.Model):
article = models.ForeignKey(Article)
On 17 juil, 20:29, Tim Chase <[EMAIL PROTECTED]> wrote:
> Fortunately, Django's ORM lets you get at the underlying SQL via
> a call to .extra() where you can provide your own WHERE clause.
> This would look something like
>
>Article.objects.extra(where="""
> app_article.id in (select arti
Hi,
Le Sat, 12 Jan 2008 20:30:25 -0800 (PST), ocgstyles
<[EMAIL PROTECTED]> a écrit :
> I need to do that often at work when Windows files are moved over to
> AIX. I just use vi. The key sequence is:
>
> :%s/^M//
If you want to mimic dos2unix, you should use
:%s/^M$//
because those
Hi,
Le Tue, 22 Jan 2008 11:07:45 -0800 (PST), "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> a écrit :
> Example:
> Processes P1, P2, model instance m, with m.val
>
> - P1 grabs the object : m = MyModel.objects.filter(get the m i want)
> [0]
> - P2 grabs the object : m = MyModel.objects.filter(get the
Hi,
Le Tue, 22 Jan 2008 11:08:41 -0800 (PST), "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> a écrit :
>
> I need InnoDB for MySQL to do row locking in hopes of this working
> efficiently.
>
> Is InnoDB on by default in MySQL 5.0?
>
> How can I tell?
Look at the "SHOW ENGINES" SQL query
http://dev.
Le Tue, 22 Jan 2008 14:18:53 -0800 (PST), Rajesh Dhawan
<[EMAIL PROTECTED]> a écrit :
> - Before you execute lines of code that need to be synchronized
> between processes, read mylock from memcached and set it to the
> current timestamp if it's null.
... and bam, another process access the lock
Hi!
Le Sun, 27 Jan 2008 09:03:25 -0800 (PST), Emil
<[EMAIL PROTECTED]> a écrit :
> Hi!
>
> I'm currently working on a couple of sites where basically all content
> is to be available in two languages. I haven't used django-
> multilingual or anything readymade, but simply created double fields
MariusB wrote:
> In the view take an URL from the query:
> query = request.POST.get('q', '')
> How do I turn query from a string into a list with one element
> (['']) in the view?
I'm not sure I understand what you mean, but if you want to transform your
"query" variable into a
single-el
invisiWeeble wrote:
> def prods_by_channel(request, slug):
>
> try:
> ch = Channel.objects.get(slug__iexact=slug)
> ct = ch.category_set.all()
> except Category.DoesNotExist:
> raise Http404
>
> return list_detail.object_lis
[EMAIL PROTECTED] wrote:
> That's the weird thing,
>
> If we restart httpd.conf the python code will be compiled in some
> cases it will show one of the projects for both ports and in a other
> case it will show the other for both ports without altering anything
> to the code. Both are working fi
boralyl wrote:
> So when I initially visit the page, it doesn't allow me to rate the
> product. So I login and it redirects me to the home page(/). The
> home page prints out my user name, so I know I am logged in. However
> if I visit that product page again it still won't let me rate the
> pr
Hi,
Brandon Taylor wrote:
>
> SetHandler python-program
> PythonPath "['C:/django_projects/testproject'] + sys.path"
> [...]
Try :
PythonPath "['C:/django_projects/'] + sys.path"
instead, since "testproject" is the subdirectory where you project lives in.
Maybe changing the
asj2008 wrote:
> We are hitting an error that disables the entire website when we have
> more than 255 web pages...this is the error we see..has anyone seen
> this before? It does not seem to be in the documentation
>
> ImproperlyConfigured at /products/
>
> Error while importing URLconf 'co
AJ wrote:
[...]
> sql = """
> SELECT MAX(`table`.`id`)
> FROM `table`
> WHERE `table`.`name` LIKE '%(kw)s'
> GROUP BY `table`.`original_id`;"""
>
> sql = sql % {'kw' : '%%' + query + '%%'}
> cursor.execute(sql)
[...]
This is the wrong way to do this, and your problem explains why.
Take a look a
[ I saw you next email, but I answer to this one, because errors are here ]
Le Tue, 15 Apr 2008 11:03:03 -0700 (PDT), AJ <[EMAIL PROTECTED]> a écrit :
> kw = 'test'
>
> sql = """
> SELECT MAX(`table`.`id`)
> FROM `table`
> WHERE `table`.`name` LIKE %s
> GROUP BY `table`.`original_id`;"""
>
> c
Thanks for all your answers !
I knew there was no One True Way of doing this, but I have more point
of views now.
I think, we might use the __str__() method, since it seems the
simplest and cleanest way of doing this (a title is a sort of
presentation in fact). Or maybe, we will stick with the g
On 18 fév, 02:34, Lachlan Cannon <[EMAIL PROTECTED]> wrote:
> Jonathan Ballet wrote:
> > I think, we might use the __str__() method, since it seems the
> > simplest and cleanest way of doing this (a title is a sort of
> > presentation in fact). Or maybe, we wi
Hi everyone,
I have a project which uses a PostgreSQL database with several tables,
and I have created VIEWs in this database.
Now, I would like to be able to use those views from my Django
project. Is there any "official" way to do this ?
Currently, I made a new Model class, with the same fiel
Hello everybody,
some days ago, my co-worker did some things which keep bothering me.
He has a simple model, which represents, as it's name point out,
err ... houses :
class House(models.Model):
price = models.FloatField(max_digits=10, decimal_places=2)
to_buy = models.BooleanField(defa
19 matches
Mail list logo