Re: How can I flush my response stream in django?

2010-10-06 Thread Emil Stenström

On Aug 24 2007, 8:18 pm, "Jeremy Dunck"  wrote:

On 8/24/07, whitesmell  wrote:
> One of my  response content was build by several synchronous method,
> how can Iflushmy  response to client browser as soon as some part of
> the  response content is ready?

The HttpResponse constructor takes either a string or an iterable.

To trickle content down, you can make the iterable a generator.


To reopen a really old thread:

For performance reasons it might be a good idea to start sending HTML
to the client before the whole page has been rendered. For instance,
flushing directly after  makes sure new HTTP requests to linked
media (CSS and JS) gets requested while the rest of the page is
loaded.

Now: Is there a nice way of doing this in Django?

--
Emil Stenström
http://friendlybit.com

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



Re: Unittest test-database not empty

2008-03-29 Thread Emil Stenström

Hi rock,

I had the same problem and traced it to one of the contrib.auth tests.
It seems they don't delete two of the testusers there. I added a
ticket about it (http://code.djangoproject.com/ticket/6923), and will
just use another username for my own tests meanwhile.

/Emil

On 30 Jan, 10:34, rock <[EMAIL PROTECTED]> wrote:
> I have no fixtures/initial_data-files anywhere in my project tree!
> Actually, the only file named "initial_data" on my system is djtrunk/
> tests/modeltests/fixtures/fixtures/initial_data.json. And that file
> doesn't contain much.
>
> The "ghost-users" only show up when I'm running "./manage.py test".
> When I delete the project database and run "./manage.py syncdb" and "./
> manage.py runserver" an empty database is created. So I guess my
> problem has something to do with the unittesting, but it is still
> magic to me how and when these users are created.
>
> Best regards,
> Stein
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Missing Related Objects in MODEL._meta.get_all_related_objects

2013-06-25 Thread Emil Stenström
On Thursday, 17 February 2011 17:09:26 UTC+1, Martin Siniawski wrote:
>
> Hey! 
>
> So we have a certain model which is related with many other models, by 
> ForeignKey fields set in those other models. 
>
> The setup is not particularly exotic, but for some reason, when 
> using ._meta.get_all_related_objects() on the model which has all the 
> ForeignKey fields pointing at it, some of the related objects that 
> should be returned are missing. 
>

This is an old thread, but since I solved a similar problem I thought I'd 
reply anyway.

What you are looking for is probably 
get_all_related_many_to_many_objects(). "get_all_related_objects" really 
just means "get_all_related_foreginkey_objects", so that could explain that 
some fields are missing.

/Emil

-- 
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.