Saturday, June 29, 2013

Re: Ajax

It would be great if serializers also supports a single object, that would make ajax requests better and / or json support for forms.
like that:
serializers.serialize('json', object) and not [object] and then i need to strip the [] tags.
also the serializers is really hard to use to make more objects as a response.

a datastructure like this:
dict = {
'object1': object ,
'list-of-objects': [object],
}
is really hard to achieve with the current implemented functionallity.

at the moment i need to do the following:
dict = {
'single-object': json.loads(serializers.serialize('json', [object]).lstrip('[').rstrip(']'))
'object-list': serializers.serialize('json', object-list)
}
json.dumps(dict)

i don't thinkt it is the best way to do.
Also I think the template engine is really 'outdated' and 'slow' compared to closure-templates, which i could use on the server-side and on the template side. (but currently i'm planning to make a python/django version of them to implement them).

Also SPA sites are coming so maybe a 'good' way to get the current history so that you could easily render a page when starting a page from something like http://www.page.com/#backend or something like that. maybe this is really hard to achieve, since the history is on the client side, but i think it would be great to have a better javascript client library for django that could do this job like django.contrib.ajax.history which could also be called with a jquery plugin.
I mean i can't replace the whole url with javascript/ajax, i can only change the last part behind #.
maybe there are a lot of things to do, to make django fully aware of Ajax.

the thing is at the moment there is no good answer to have both worlds. a server-side-framework that also has a good client-side-framework. ok there a plenty of answers, but not in python, only in java. (gwt, eclipse rap, javafx) but in python you can only have one and you need to do both things really good. 
so it makes it very hard to write good code, since you always need to implement both sides. i mean this wouldn't be a problem when some things would be easier.
as already said the serializers needs some work, the template engine and many things i don't even have on my mind. but for the start a better serializers would be great.

(also you need to return a json object to serializers if you have foreign keys to make use of them in some situations or you make dozen of new http request for every new object would could be a pain in the a**)

Am Samstag, 29. Juni 2013 12:05:33 UTC+2 schrieb Russell Keith-Magee:

Can you provide a little more direction than "The website"? "The website" is a kinda big place… :-)

Yours,
Russ Magee %-)

On Sat, Jun 29, 2013 at 2:08 PM, Gamesbrainiac <gamesb...@gmail.com> wrote:

Then why does itsay on the website that Django does not support Ajax natively?

On Jun 29, 2013 12:03 PM, "Russell Keith-Magee" <rus...@keith-magee.com> wrote:

I'm not sure what you mean. Django completely supports AJAX right now. 

Django is a server-side framework, and the only part of AJAX that is server-side is the API call. 

An API call is just a view that returns JSON/XML instead of HTML. You can write that right now in Django.

If you want a library to make it even easier, there are several options, including TastyPie and Django-REST-Framework.

The client-side part of the AJAX problem is outside the domain of Django. There are plenty of good client-side frameworks; pick one, and you'll find it can talk perfectly well with Django.

Yours,
Russ Magee %-)

On Sat, Jun 29, 2013 at 1:52 PM, Nafiul Islam <gamesb...@gmail.com> wrote:
In which version, will Django natively support Ajax? I'm curious because you need Ajax for almost any site these days, and Django not supporting it natively has become a bit of a hindrance for me.

--
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...@googlegroups.com.
To post to this group, send email to django...@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 a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/2oaiisZw_ZY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@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...@googlegroups.com.
To post to this group, send email to django...@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+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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Ajax

Sorry, was on a mobile phone. Let me give you exact link, please excuse me being a little stupid.

https://code.djangoproject.com/wiki/AJAX -> First line, "Django does not natively support Ajax". Now, this was weird, because I've seen others use Ajax with Django, for example in this tutorial: https://racingtadpole.com/blog/django-ajax-and-jquery/. Now, I tried to replicate it, and it worked fine. However, since I don't know all that much about Ajax, I thought there was more to it than what was described in that website, since it says that Django does not natively support Ajax. So, what was meant by this statement, and what does it mean to 'natively' support Ajax.

Thanks, and Kind Regards as always.


On 29 June 2013 16:05, Russell Keith-Magee <russell@keith-magee.com> wrote:

Can you provide a little more direction than "The website"? "The website" is a kinda big place… :-)

Yours,
Russ Magee %-)


On Sat, Jun 29, 2013 at 2:08 PM, Gamesbrainiac <gamesbrainiac@gmail.com> wrote:

Then why does itsay on the website that Django does not support Ajax natively?

On Jun 29, 2013 12:03 PM, "Russell Keith-Magee" <russell@keith-magee.com> wrote:

I'm not sure what you mean. Django completely supports AJAX right now. 

Django is a server-side framework, and the only part of AJAX that is server-side is the API call. 

An API call is just a view that returns JSON/XML instead of HTML. You can write that right now in Django.

If you want a library to make it even easier, there are several options, including TastyPie and Django-REST-Framework.

The client-side part of the AJAX problem is outside the domain of Django. There are plenty of good client-side frameworks; pick one, and you'll find it can talk perfectly well with Django.

Yours,
Russ Magee %-)

On Sat, Jun 29, 2013 at 1:52 PM, Nafiul Islam <gamesbrainiac@gmail.com> wrote:
In which version, will Django natively support Ajax? I'm curious because you need Ajax for almost any site these days, and Django not supporting it natively has become a bit of a hindrance for me.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/2oaiisZw_ZY/unsubscribe.
To unsubscribe from this group and all its topics, 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.
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/2oaiisZw_ZY/unsubscribe.
To unsubscribe from this group and all its topics, 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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Kind Regards,

Quazi Nafiul Islam

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Help in finding how to learn Django

Thank you Mike. Very helpful.

On Friday, June 28, 2013 9:49:20 AM UTC+2, Nico Subs wrote:
Hi all,

What is the best way to learn Django 1.5 thouroughly? I have been a .NET developer and have a really good understanding of OOP, HTML5, CSS and JavaScript. I also have an entry-level knowledge of Python. I am completely new to MVC (or MVT, in this case).

I have a need to build apps with Django that provide users with features such as finding each other based on geographical distance, upload pictures and edit them online, natural language search, etc... (just to highlight that I need to know more than how to build a poll app or a simple blog).

My understanding is that the entry point to learn Django is by completing the tutorial at the Django project site. Then, what? What path would you recommend? I have seen that lots of learning resources on the web target versions lower than 1.5 and I couldn't really find books on 1.5. When reading reviews on learning material on 1.4, I often see they are outdated and not really applying to 1.5.

Also, I briefly looked at what it takes to deploy a Django app. Virtualenv, git, pip, etc... are all things unknown to me and it looks a bit scary for a guy used to deploy apps by uploading the compiled binaries through FTP.

Help in defining a clear path to learn how to bend Django to my will would be invaluable!

Thank you for your time.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

How to Test Querysets

I would like to be able to replace the hardcoded repr in the test with an actual queryset.

def test_index_view_with_a_past_poll(self):          """          Polls with a pub_date in the past should be displayed on the index page.          """          create_poll(question="Past poll.", days=-30)          response = self.client.get(reverse('polls:index'))          self.assertQuerysetEqual(              response.context['latest_poll_list'],              ['<Poll: Past poll.>']          )    #new  def test_index_view_with_a_past_poll(self):          """          Polls with a pub_date in the past should be displayed on the index page.          """          create_poll(question="Past poll.", days=-30)          response = self.client.get(reverse('polls:index'))          self.assertQuerysetEqual(              response.context['latest_poll_list'],              repr(Poll.objects.filter(question="Past poll."))          )

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Ajax

Hi,

Django can serve Ajax request from any client.

Some ajax APP sent json format data to the client some APP just sent partial view to the client as ajax update.

Which ever your choise to use with django, it can be done.

I have the second type ajax APP, serve from django APP and update the partial view.



Sent from my iPhone

On 29 Jun 2013, at 18:15, Christophe Pettus <xof@thebuild.com> wrote:

> It's also not clear to me what "(not) supporting Ajax" would even mean. Ajax just sends HTTP requests, and the server responds to them (usually with JSON structures). I have tons of Ajax applications that use Django as the backend, so if it doesn't support it, no one tell that code lest it stop working. :-)
>
> On Jun 29, 2013, at 12:05 PM, Russell Keith-Magee wrote:
>
>>
>> Can you provide a little more direction than "The website"? "The website" is a kinda big place… :-)
>>
>> Yours,
>> Russ Magee %-)
>>
>> On Sat, Jun 29, 2013 at 2:08 PM, Gamesbrainiac <gamesbrainiac@gmail.com> wrote:
>> Then why does itsay on the website that Django does not support Ajax natively?
>>
>> On Jun 29, 2013 12:03 PM, "Russell Keith-Magee" <russell@keith-magee.com> wrote:
>>
>> I'm not sure what you mean. Django completely supports AJAX right now.
>>
>> Django is a server-side framework, and the only part of AJAX that is server-side is the API call.
>>
>> An API call is just a view that returns JSON/XML instead of HTML. You can write that right now in Django.
>>
>> If you want a library to make it even easier, there are several options, including TastyPie and Django-REST-Framework.
>>
>> The client-side part of the AJAX problem is outside the domain of Django. There are plenty of good client-side frameworks; pick one, and you'll find it can talk perfectly well with Django.
>>
>> Yours,
>> Russ Magee %-)
>>
>> On Sat, Jun 29, 2013 at 1:52 PM, Nafiul Islam <gamesbrainiac@gmail.com> wrote:
>> In which version, will Django natively support Ajax? I'm curious because you need Ajax for almost any site these days, and Django not supporting it natively has become a bit of a hindrance for me.
>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/2oaiisZw_ZY/unsubscribe.
>> To unsubscribe from this group and all its topics, 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.
>> 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.
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> -- Christophe Pettus
> xof@thebuild.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+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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Render dynamic form based on meta data

Django can handle some of that for you but not all, you will need to use javascript to handle the dynamics on the page itself., I use jquery, and use django to take the ajax calls and return data.

If you don't have that much data you could just add it to the HTML page in javascript structures, would be easier to deal with than making ajax calls.

Cheers

François

On Jun 29, 2013, at 5:28 AM, Avishay Balderman <balderman@gmail.com> wrote:

> Hi
> I need to implement a django app that has the following capabilities:
> 1) When the main page loads it needs to dynamically (Ajax) populate a combo (<select>) with a list of "form types"
> 2) When the user select an item from the "form types" combo, the app should issue Ajax call and fetch meta data. This meta data will bu used in order to render a form.
>
> Can you please advice?
>
> Thanks
>
> Avishay
>
>
> --
> 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Ajax

It's also not clear to me what "(not) supporting Ajax" would even mean. Ajax just sends HTTP requests, and the server responds to them (usually with JSON structures). I have tons of Ajax applications that use Django as the backend, so if it doesn't support it, no one tell that code lest it stop working. :-)

On Jun 29, 2013, at 12:05 PM, Russell Keith-Magee wrote:

>
> Can you provide a little more direction than "The website"? "The website" is a kinda big place… :-)
>
> Yours,
> Russ Magee %-)
>
> On Sat, Jun 29, 2013 at 2:08 PM, Gamesbrainiac <gamesbrainiac@gmail.com> wrote:
> Then why does itsay on the website that Django does not support Ajax natively?
>
> On Jun 29, 2013 12:03 PM, "Russell Keith-Magee" <russell@keith-magee.com> wrote:
>
> I'm not sure what you mean. Django completely supports AJAX right now.
>
> Django is a server-side framework, and the only part of AJAX that is server-side is the API call.
>
> An API call is just a view that returns JSON/XML instead of HTML. You can write that right now in Django.
>
> If you want a library to make it even easier, there are several options, including TastyPie and Django-REST-Framework.
>
> The client-side part of the AJAX problem is outside the domain of Django. There are plenty of good client-side frameworks; pick one, and you'll find it can talk perfectly well with Django.
>
> Yours,
> Russ Magee %-)
>
> On Sat, Jun 29, 2013 at 1:52 PM, Nafiul Islam <gamesbrainiac@gmail.com> wrote:
> In which version, will Django natively support Ajax? I'm curious because you need Ajax for almost any site these days, and Django not supporting it natively has become a bit of a hindrance for me.
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/2oaiisZw_ZY/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
> 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.
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
-- Christophe Pettus
xof@thebuild.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+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.
For more options, visit https://groups.google.com/groups/opt_out.