Saturday, March 30, 2013

Re: Doubt regarding JSON/SQL in Django

Thank you all for your prompt replies :)

> IIUC you can't return the query (as a python object) to the client. You must convert the data on it to some format (json, xml, ...) that the client understands. That will depend on the libraries that you use in the client side.

So, if I don't use JSON as storage and only as a format to send data
to client ( All the parsing will be done client side ), is it better
than using {{ task.name }}, {{ task.start_date }} ? ( Sorry to ask
this again, but i haven't got it )

> You almost certainly don't want to use JSON as your storage method.

What if all of my logic is on the client side, and I just send an
encoded JSON file to the server only for storage ? Your single model
option is looking better than this, but won't query time take longer
as the no. of users increase ? ( Sorry if this is abstract, but my
MySQL level is basic )


On Sat, Mar 30, 2013 at 7:37 PM, Alan Johnson <alan@breakrs.com> wrote:
> You almost certainly don't want to use JSON as your storage method. This is
> a database problem, and the Django ORM really shines at letting you solve it
> without having to think super hard about database modeling. You wouldn't
> create a table for each user's task list. You would create a model called
> Task, which is has a foreign key to your user model. The ORM then defines
> one table for all tasks for all users, and it's easy to get the tasks for a
> single user using the reverse relationship on the foreign key. You should
> really check out the Django project docs to sort through how this works.
>
> The alternative NoSQL approach would be to make the task list for each users
> a schemaless document in a system like MongoDB, but to my mind, a simple
> task list is a good problem for straightforward, relational Django.
>
>
> On Saturday, March 30, 2013 9:14:20 AM UTC-4, Parin Porecha wrote:
>>
>> Hi,
>>
>> I have just started using Django. I want to create a to-do task
>> manager application. Users would register, login and can work with
>> their tasks. So, instead of creating a table in the database for each
>> user, I want to create a JSON file for each user which will store all
>> his tasks.
>>
>> Is there any way I can do this in Django ?
>> I mean, use the database only for authentication, and use JSON to
>> store data instead of storing it in the database.
>>
>> Thanks,
>> Parin
>
> --
> 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+unsubscribe@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?hl=en.
> 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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment