On Oct 8, 9:00 pm, Shailen <shailen.t...@gmail.com> wrote:
>
> Option 2, use list properties:
>
>    class URL(db.Model):
>        url = db.StringProperty()
>
>    class Tags(db.Model):
>        tags = db.StringListProperty()
>
> Store a list of tags with a URL key as parent.


Why not simply add the tags to the URL entity?

class URL(db.Model):
    url = db.StringProprety()
    tags = db.StringListProperty()

    @classmethod
    def fetch_by_tag(cls, *tags):
        query = URL.all()
        for t in tags:
            query.filter('tags =', t)
        return query.fetch()

urls = URL.fetch_by_tag('foo', 'bar', 'baz')


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to