Good.

well if you use to serialize Models often your solution is the best and probably the cleaner one :)

Nice work :)

Regards.

Giulio


Il 05/08/2013 16:28, Mário Idival ha scritto:
thanks for answering my question... But i find an way better for this.

I create an gist explaining how to do : https://gist.github.com/marioidival/6156074


Thanks!

Mário Idival

*Twitter *: */@marioigd/*
*Facebook*: */mario.idival/*
/*User Linux* :**/*#554446*
Skype/: marioidival/
*Blog: *https://conconcus.wordpress.com


2013/8/5 Giulio Calacoci <asdmas...@gmail.com <mailto:asdmas...@gmail.com>>

    Hi,

    How do you fill the JSON?
    You use the Document class as Main entity ?

    Because if you have a Document entity, simply use the internal
    reference to the related object.

    example:

    Assuming that you are filling a Map and then use the map for a
    quick JSON transform.

    {
        'Document id': document.id <http://document.id>,
        'Related Layout id': document.layout.id
    <http://document.layout.id>,
        'Related Layout Name', document.layout.name
    <http://document.layout.name>,
    }

    or you can perform a query using the Django orm, using the
    document_id as filter.
    Example:

    layout =
    Layout.objects.get(document_id=<id_of_the_related_document_object>)

    This is just a guess of how things works on your program... but
    maybe it's a starting idea.
    Or maybe I've misunderstood you problem and I'm totally wrong :D

    Regards
    Giulio.



    Il 05/08/2013 14:49, Mário Idival ha scritto:
    Good morning,
    I have this situation:

    I have 3 classes, Document, Layout and Company

    1 Document has 1 Layout 1 and Company ..
    Document class:
        layout = models.ForeignKey (Layout)
        company = models.ForeignKey (Company)

    I have a search page that is being filled by JSON, then the data
    layout and the company is returning the ID of them respectively,
    and the ideal would be to show the names of each data (Name and
    Company Name Layout) ..

    How can I accomplish this query so that I quoted above?

    Sincerely, o /
    Mário Idival

    *Twitter *: */@marioigd/*
    *Facebook*: */mario.idival/*
    /*User Linux* :**/*#554446*
    Skype/: marioidival/
    *Blog: *https://conconcus.wordpress.com
-- You received this message because you are subscribed to the
    Google Groups "Django users" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to django-users+unsubscr...@googlegroups.com
    <mailto:django-users+unsubscr...@googlegroups.com>.
    To post to this group, send email to
    django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
    Visit this group at http://groups.google.com/group/django-users.
    For more options, visit https://groups.google.com/groups/opt_out.



-- You received this message because you are subscribed to the Google
    Groups "Django users" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to django-users+unsubscr...@googlegroups.com
    <mailto:django-users%2bunsubscr...@googlegroups.com>.
    To post to this group, send email to django-users@googlegroups.com
    <mailto:django-users@googlegroups.com>.
    Visit this group at http://groups.google.com/group/django-users.
    For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to