Ivan Sagalaev wrote:
> EricHsu wrote:
>
> >is it possible to make sure that
> >categorys.get_list(id__in=category_id_list) returns category object
> >list in the same order as category_id_list?
> >
> Nope. The order of a result of a query without 'ORDER BY' is undefined.
> But as soon as you have
hi all,
I've done some search, however, I guess I should ask for your helps
here:
I have the following models: (pseudo code)
class ArticleType:
name = ...
class Article:
title = ...
article_type = meta.ForeignKey(ArticleType)
class Game:
name = ...
articles = meta.ManyToMa
Ivan Sagalaev wrote:
> g.get_article_list(article_type_id__exact=1)
> It's g.get_article_list(article_type__id__exact=1). Note 2 underscores
> before "id" which means field "id" of a parent table.
sorry for mistyped that, I tried this:
>>> g.get_article_list(article_type__id__exact=1)
Traceb
hello, could anybody pls help? I don't want to write dirty sql if I
could do it via django ORM...
BiG thanks! :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send ema
Ivan Sagalaev wrote:
> nkeric wrote:
>
> >hello, could anybody pls help? I don't want to write dirty sql if I
> >could do it via django ORM...
> >
> >
> Well... The only thing I could work out is this:
>
> articles = [a for a in g.get_article_list() if
Ivan Sagalaev wrote:
> You might want to look into magic-removal branch where things like this
> are made possible with ORM.
Really? That's cool!
Our site (http://www.ifaxian.com - a Chinese Digg-like site) built upon
the svn trunk version, we're planning to migrate to the m-r branch
soon, I gue
=
game_sku.id and game_sku_articles.article_id = articles.id" % locals()
I was wondering how to "get a spefic type of articles of a gamesku
while gamesku & articles' relationship is many-to-many" in django
trunk..
Bi
hi all,
I would like to know if simon's AbstractSearching still working with
the django m-r branch?
https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/AbstractSearching
Regards,
- Eric
--~--~-~--~~~---~--~~
You received this message because you are s
hi all,
yet another question here:
I enabled the 'django.contrib.comments' in the settings.py
then, I ran:
$ python manage.py syncdb
I got the following error:
-
Creating table comments_comment
Creating table comments_freecomment
Creating table comment
wow, it works!
BiG thanks to Rudolph, you've been a great help!
- Eric
--~--~-~--~~~---~--~~
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 un
guys,
today while I'm using the comments module to implement something, I
guess I found two bugs:
1. in the models.py, the get_list_with_karma method should be updated
to use the extra() method to inject the "select" kwargs, otherwise, the
templatetag get_comment_list won't work;
2. in the view
Malcolm Tredinnick wrote:
> I cannot comment much on the patch, not being familiar with the comments
> component (although the commented out debugging stuff should probably be
> removed), but it would be best to open a ticket for this patch, so that
> it doesn't get lost (http://code.djangoproject
hi all,
I'm trying to use the generic view to slim down my code. here I
encountered a question:
I would like to use the generic object_list to list articles by
category, so, here is what I'm trying to do:
in urls.py -
article_list_dict = {
'queryset': Article.objects.all(),
}
urlpatterns
WoW! I'm currently using the 1st workaround :)
the 2nd one enlightens me a lot!
BiG thanks to Ivan :-D
btw, how about creating a more generic patch for django's generic view
methods? Since this is really a "generic" scenario - I usually need to
"get some object list by some condition" :)
--~--~
Matthew McDonald wrote:
> That would be extremely handy to have. I too thought Nkeric's first
> pattern should work how it looks:
hey, that's a good idea IMO :)
I guess I'm going to spend sometime on it to see if I could create a
patch for this base on Ivan's approach & Matthew's idea :)
--~--~
FYI, we're using django's 0.95 trunk version to handle Chinese
contents, django works properly whether with sqlite3 or postgresql as
its db backend. pre-magic-removal django worked properly too.
I guess it should be something reated to mysql's internal encoding?
AFAIK, you will need to specified
nkeric wrote:
> I guess it should be something reated to mysql's internal encoding?
> AFAIK, you will need to specified mysql's encoding to utf-8 before
> using it :)
- since mysql version >= 5.0 :)
--~--~-~--~~~---~--~~
You received this m
Ivan Sagalaev wrote:
> This is the question of where you stop adding functionality to
> generic views. On one end there is a solution so basic that it is not
> useful to anyone and on the other end there is a solution so bloated
> that nobody event wants to start to learn how to use it :-). I thin
http://jtauber.com/blog/2006/05/23/primitive_python_version_of_gwt_working
Someone posted this to our site: James Tauber has built "a Python
equivalent to the Google Web Toolkit (GWT)" -
http://code.google.com/webtoolkit
It's interesting :)
--~--~-~--~~~---~--~~
hi Jaroslaw,
I guess you're trying to implement multipage forms.
here is the basic ideas:
1. set a 'step' flag in your view function for determine the current
step the user is doing
2. use the form manipulator.fields.append(forms.) to
dynamically create form's layout base on 'step'
3. while pr
hi all,
I'm using the NullBooleanField for my Content model:
class Content(models.Model):
deleted = models.NullBooleanField(default=False, blank=True)
...
that creates the following field in db:
"deleted" bool NULL
I got KeyError while trying to create a new content record without t
sqlite> select * from django_content_type where (app_label='aiyo' and
model='content') or (app_label='aiyo' and model='product');
17|Product|aiyo|product
24|Content|aiyo|content
hi all,
I've tried:
ContentType.objects.filter(Q(app_label__exact='aiyo',
model__exact='content') | Q(app_label__exac
>>> ContentType.objects.filter((Q(app_label__exact='aiyo') &
>>> Q(model__exact='content')) | (Q(app_label__exact='aiyo') &
>>> Q(model__exact='product')))
[, ]
>>> c.queries [{'time': '0.000', 'sql': 'SELECT
>>> "django_content_type"."id","django_content_type"."name","django_content_type"."app
James Bennett wrote:
> Also keep in mind that as a query gets more and more complex, the odds
> of any ORM syntax being able to express it cleanly and concisely get
> smaller and smaller; there will be times when it'll be faster and
> easier (well, easier so long as you know SQL) to drop down into
Scott Anderson wrote:
> You could also do this:
>
> ContentType.objects.filter(app_label__exact='aiyo',
> model__in=('content', 'product'))
>
> which is more concise and may treat the query optimizer in your database
> better.
hi Scott,
this is great! however, I'm having another problem, let me
hi Jay,
IMO, you will have to do the unique contrain in the db level, here is
the tagging model stuff I'm working on:
class Tag(models.Model):
name = models.CharField(maxlength=40, unique=True,
db_index=True)
invisible = models.NullBooleanField(default=False)
def __str__
Jay Parlar wrote:
> That's a pretty neat way to do it, I'm going to have to try it out. Do
> you use a ManyToManyField between your actual objects (like a blog
> Post, for instance) and the ObjectTag?
>
> Jay P.
hi Jay,
Since the ObjectTag model is the m2m table between the actual object
(which
hi all,
a small question, I'm trying to clean up a string, replacing multiple
spaces with a single space, multiple "-"s "."s with single "-" & ".",
my current code is:
decoded_string = re.sub('[\s]+', ' ', decoded_string)
decoded_string = re.sub('[-]+', '-', decoded_string)
decoded_s
James Bennett wrote:
> The fact that you've got three different regular expressions with
> three different substitutions to do means that this needs to be three
> logical operations. However, you can make this slightly easier on
> yourself by building a dictionary of the patterns and substitutions
hi all,
I have a m2m table recording object & it's tags, here is part of the
table data:
object_idtag_id
115
116
215
316
415
416
417
I would like to select object_ids where tag_id
hi Malcolm,
thank you very much for your quick reply!
I knew I need to build my custom SQL, my friend (who is a db master :)
just came back and suggests me to do this:
select object_id, count(*) from tagging_object_tag where tag_id in (15,
16) group by object_id having count(*)=2;
pretty cool
o, the count(*) is unnecessary,
select object_id from tagging_object_tag where tag_id in (15,
16) group by object_id having count(*)=2;
;)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
Malcolm Tredinnick wrote:
> At the moment, you need to write some custom SQL to implement this. One
> possible solution is here:
> http://www.pointy-stick.com/blog/2006/06/14/custom-sql-django/
hi Malcolm,
sorry I missed your link, I just look into your doc & code, pretty much
the same as my fri
Maciej Blizinski wrote:
> I'd like to suggest alternative SQL solution which performs better.
> With my example database Malcolm's query takes 214ms to execute, while
> my query does the same job in 5.8ms, which is 36 times faster.
>
> My solution is described here:
> http://groups.google.com/grou
what about pylucene?
http://pylucene.osafoundation.org/
we're using it for indexing our site & searching :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email t
[EMAIL PROTECTED] wrote:
> pyLucene: no docs, SWIG/Java like api (not nice)
quote from pylucene's page:
As of release 2.0, SWIG is no longer used. The Python wrapper objects
are implemented by hand using the Python C Type System for better
integration with Python and for faster C++/Java access.
/hierarchical-data-database
.. _GenericForeignKey:
http://feh.holsman.net/articles/2006/06/19/django-generic-relations
--
- http://www.ifaxian.com
- http://groups.google.com/group/nkeric-daily
- http://nkeric.3322.org
--~--~-~--~~~---~--~~
You received this messag
Cheng Zhang wrote:
> Great.
> If you get time, I suggest you update the wiki page accordingly.
ok, I'll do that soon.
plus, a bug fix to the views.py
in the node_tree method, the node_list line should add an
order_by('lft') to it:
node_list = Node.objects.filter(tree_id__exact=root.tree_id,
lf
hi Seth,
here is a link to the tagging models I've done in my project, you may
want to have a look :)
http://groups.google.com/group/django-users/browse_thread/thread/50b6712cd7738d9d/4b654db1ecaf4b2f?lnk=gst&q=ObjectTag&rnum=1#4b654db1ecaf4b2f
Here is the basic ideas of my tagging app:
1. a
39 matches
Mail list logo