Re: Selecting data from intermediate table in prefetch_related results in duplicate rows

2018-05-20 Thread Tomáš Ehrlich
e` doesn’t work when used inside `prefetch_related`. 1. Is it bug? Should it work in the same way as when used outside `prefetch_related`? 2. Is there a way to avoid `extra` method? It should be avoided at all cost, after all. Thank you in advance! Tom > 20. 5. 2018 v 11:41, Tomáš Ehrl

Selecting data from intermediate table in prefetch_related results in duplicate rows

2018-05-20 Thread Tomáš Ehrlich
Hello, I have a two models (User, Project) in m2m relationship with intermediate (Role) table. When I’m selecting all users in project and I also want to select corresponding role, I simply annotate one field from Role table using F expression: Users.objects.all().filter(projects__name=‘Django’

Re: Window expression inside Subquery

2018-02-28 Thread Tomáš Ehrlich
It seems to be a bug in Django. Here's the ticket (https://code.djangoproject.com/ticket/29172) with patch and tests if anyone is interested in this topic. Cheers, Tom Dne čtvrtek 1. března 2018 7:38:13 UTC+1 Tomáš Ehrlich napsal(a): > > Hey folks, > I’m getting an AttributeEr

Window expression inside Subquery

2018-02-28 Thread Tomáš Ehrlich
Hey folks, I’m getting an AttributeError: 'NoneType' object has no attribute ‘relabeled_clone' when using Window expression inside Subquery: Message.objects .filter(pk__in=Subquery( Message.objects .annotate(latest_pk=Window( expression=FirstValue('pk'), partition_by=[F('c

Re: [django-channels] Testing events from post_save signal

2018-02-25 Thread Tomáš Ehrlich
a long, hard road :) > > Andrew > > On Sun, Feb 25, 2018 at 10:37 AM, Tomáš Ehrlich <mailto:tomas.ehrl...@gmail.com>> wrote: > Of course! > > It works now perfectly, thank you. Sorry I missed that in docs. > > Cheers, >Tom > >> 25. 2. 2018 v 19

Re: [django-channels] Testing events from post_save signal

2018-02-25 Thread Tomáš Ehrlich
cs.io/en/latest/topics/databases.html > <http://channels.readthedocs.io/en/latest/topics/databases.html> > > Andrew > > On Sun, Feb 25, 2018 at 7:14 AM, Tomáš Ehrlich <mailto:tomas.ehrl...@gmail.com>> wrote: > Here's the gist > (https://gist.github.c

Re: [django-channels] Testing events from post_save signal

2018-02-25 Thread Tomáš Ehrlich
Here's the gist (https://gist.github.com/tricoder42/af3d0337c1b33d82c1b32d12bd0265ec) with consumer. Dne neděle 25. února 2018 15:37:19 UTC+1 Tomáš Ehrlich napsal(a): > > Hello, > I’ve just migrated my project to django-channels 2.x. Thanks to everyone > involved! > >

[django-channels] Testing events from post_save signal

2018-02-25 Thread Tomáš Ehrlich
Hello, I’ve just migrated my project to django-channels 2.x. Thanks to everyone involved! I’m trying to write a test for a consumer. I have a post_save signal receiver, which sends a message to a group. As I understand, I need to wrap `group_send` with `async_to_sync` because django signals can’

Re: [django-channels] Running multiple daphne servers

2018-02-19 Thread Tomáš Ehrlich
suming you are using Channels/Daphne 1, then the channel layer >> configuration is what determines what handles the requests. >> >> If you're seeing environments answer each other's requests, check they >> really are using different Redis databases, and con

Re: [django-channels] Running multiple daphne servers

2018-02-19 Thread Tomáš Ehrlich
different Redis databases, and consider changing the prefix setting > on the channel layer instead. > > Andrew > > On Mon, Feb 19, 2018 at 8:34 AM, Tomáš Ehrlich <mailto:tomas.ehrl...@gmail.com>>wrote: > Hello everyone, > I'm running two instances of Daphne o

[django-channels] Running multiple daphne servers

2018-02-19 Thread Tomáš Ehrlich
Hello everyone, I'm running two instances of Daphne on my server (one per environment, production/staging). I'm using UNIX sockets behind nginx, but production requests are sent to staging and vice versa. Workers and Daphne are using the same settings per environment (I'm using Redis as a chan

Re: [django-channels] post-process message from Group

2018-01-18 Thread Tomáš Ehrlich
ou want > to start playing around with it now you can: > http://channels.readthedocs.io/en/2.0/ > > Andrew > > On Wed, Jan 17, 2018 at 5:42 AM, Tomáš Ehrlich > wrote: > >> Hello everyone, >> I’m trying to connect django-channels with GraphQL subscriptions (usin

[django-channels] post-process message from Group

2018-01-17 Thread Tomáš Ehrlich
Hello everyone, I’m trying to connect django-channels with GraphQL subscriptions (using graphene and underlying graphql-core library). I’m basically doing sth similar to example in [docs](https://channels.readthedocs.io/en/latest/concepts.html#groups

Re: Research: Translations od documentation

2015-02-26 Thread Tomáš Ehrlich
tvrtek 26. února 2015 13:25:38 UTC+1 Tim Graham napsal(a): > > Maybe you aren't aware of the existing opportunity to translate Django's > documentation? > > > https://docs.djangoproject.com/en/dev/internals/contributing/localizing/#documentation > > On Thursda

Research: Translations od documentation

2015-02-26 Thread Tomáš Ehrlich
Hello, tonight is regular python/ruby meetup in Brno (Czech republic) about documentation. Last few months I’ve been working on project concerning localization of documents. I would like to know your opinion about localization of documentation: Do you think it would be useful to translate docum

Re: Smoke tests

2015-01-26 Thread Tomáš Ehrlich
t; redundant. There are also tools to help speed up those tests, which might > be worth investigating before adding another test layer. > > On Saturday, 24 January 2015 17:22:04 UTC+2, Tomáš Ehrlich wrote: >> >> Hello, >> last few weeks I’ve been thinking about

Re: Smoke tests

2015-01-26 Thread Tomáš Ehrlich
re working > correctly. If you have set up your application correctly, then you > will be catching these errors as they happen (e.g. Raven JS). > > I don't know why "smoke tests" are suddenly becoming the new buzz > phrase > > Anyway, hope this hel

Smoke tests

2015-01-24 Thread Tomáš Ehrlich
Hello, last few weeks I’ve been thinking about implementing smoke tests into my deployment process. Last week I wrote simple test runner (https://github.com/djentlemen/django-smoked ), but still I’m missing methodology *what* should I test and *how*.

Re: Dutch translation of Django Tutorial

2014-10-26 Thread Tomáš Ehrlich
e it's ready. Thank you in advance! Cheers, Tom Dne neděle, 26. října 2014 13:23:43 UTC+1 Erwin Sprengers napsal(a): > > Hi, > > Depending on the size, I can help to review. > > Erwin > > Op zaterdag 25 oktober 2014 13:36:11 UTC+2 schreef Tomáš Ehrlich: >> &

Dutch translation of Django Tutorial

2014-10-25 Thread Tomáš Ehrlich
Hello everyone, there are two things that going to happen in next month: 1. Django Under the Hood conference in Amsterdam 2. (Hopefully) I’ll finish SaaS for managing translations. The first frontend build on top of gettext message catalogues will be for Sphinx documentation. As a result, I woul

Re: Deployment of django project using setuptools

2014-05-02 Thread Tomáš Ehrlich
I've started experimenting with this idea and created simple app: https://github.com/elvard/django-deploy I would very appreciate any opinions, ideas or second thoughts. Cheers, Tom Dne pátek, 2. května 2014 19:13:30 UTC+2 Tomáš Ehrlich napsal(a): > > Hi there, > when I de

Re: db queries made twice

2013-08-31 Thread Tomáš Ehrlich
Other option is set SHOW_TEMPLATE_CONTEXT to False in DEBUG_TOOLBAR_CONFIG. See https://github.com/django-debug-toolbar/django-debug-toolbar#configuration Dne sobota, 31. srpna 2013 13:24:54 UTC+2 Tomáš Ehrlich napsal(a): > > Hi, > disable Template panel in debug_toolbar and

Re: Namespace URLs in TestCase

2013-07-04 Thread Tomáš Ehrlich
as it prints all url patterns which 'reverse' function tried. Sorry for spam, but it took me a while to found it. Cheers, Tom Dne čtvrtek, 4. července 2013 16:53:34 UTC+2 Tomáš Ehrlich napsal(a): > > Hi there, > it's probably silly bug, but I can't figure it

Re: django multi db routing doesnt work wich multiple schemas

2012-10-12 Thread Tomáš Ehrlich
Sorry, I've just found that schema != tablespace, so my last response is irelevant... Cheers, Tom Dne pátek, 12. října 2012 19:26:53 UTC+2 Tomáš Ehrlich napsal(a): > > Hi Michał, > is "schema" the same as thing as "tablespace"? If so, you should define

Re: Unhandled exception during validation

2012-10-12 Thread Tomáš Ehrlich
Hello Oyvind, that's weird, Django (or Python in general) usually provide very long and descriptive trackback. Could you please provide more information? What version of Python do you have? Does it fail when you run ./manage.py runserver? You've mentioned, the error is in local app, does that

Re: "Writing your first Django app" Tutorial Question

2012-10-12 Thread Tomáš Ehrlich
Hi Stefano, your understanding is incorrect. Django (neither Python) doesn't load (or import) anything by himself. Everything what you import is everything what you get. There are few exceptions, like Python builtin module (and default tags/templates in Django templates), but that's definitely n

Re: A very basic question with Django

2012-10-09 Thread Tomáš Ehrlich
Ehm, It's not disgus but http://www.disqus.com ;) Sorry... Dne středa, 10. října 2012 8:09:07 UTC+2 Tomáš Ehrlich napsal(a): > > Hello, > I wouldn't say that Django is not suitable for web development. Even when > someone says it's not, it's just an op

Re: A very basic question with Django

2012-10-09 Thread Tomáš Ehrlich
Hello, I wouldn't say that Django is not suitable for web development. Even when someone says it's not, it's just an opinion, but in general, Django is framework for web development. A1: Django has many batteries included. Database access through object relational model and form processing are

Re: Model translation

2011-07-08 Thread Tomáš Ehrlich
Yes, transmeta is straightforward and simple. This is the main advantage, but also the biggest disadvantage. Moreover, i'm scared of altering big tables with lots of columns every time I want to add another language. On 8 čnc, 21:06, smac...@flagstonesoftware.com wrote: > +1 for transmeta but I on

Model translation

2011-07-08 Thread Tomáš Ehrlich
Hi there, I just want to open discussion about this topic again, because I didn't find any solution which 100% fits my needs. What I want: - store translations in other table (1:N) - storing additional info, if necessary (translation_date, translation_edit_date, translator_name, etc) - keeping

Re: Using Jinja2

2011-07-08 Thread Tomáš Ehrlich
Hi there, this looks interesting: http://jinja.pocoo.org/docs/switching/#django I'll try it soon On 8 čnc, 16:43, Venkatraman S wrote: > On Fri, Jul 8, 2011 at 8:03 PM, akaariai wrote: > > > Trying jinja2 in your project is hard - you are using some template > > tags, and you would need to port

Re: ANN: django-iadmin

2011-07-05 Thread Tomáš Ehrlich
Hi Sax, I've found, where is a problem, but it's much more complicated. I've just filled issue: https://github.com/saxix/django-iadmin/issues/2 Hope we'll fix it soon, need to go sleep now On 5 čnc, 23:18, Tomáš Ehrlich wrote: > I'm using latest Django svn checkou

Re: ANN: django-iadmin

2011-07-05 Thread Tomáš Ehrlich
django-iadmin/issues?sort=created&direction=... > > let me know as i can help you > > sax > > 2011/7/5 Tomáš Ehrlich > > > > > > > > > Hi Sax, > > thanks for your work, i've already put it into my project. > > > Unfortunately,

Re: ANN: django-iadmin

2011-07-05 Thread Tomáš Ehrlich
Hi Sax, thanks for your work, i've already put it into my project. Unfortunately, I've got this error when accessing change_list view. Some apps works fine, but some of them shows this exception: File "/usr/lib/python2.6/dist-packages/django/contrib/admin/views/ main.py" in __init__ 81.

django.contrib.admin - custom css class in result_headers

2011-06-30 Thread Tomáš Ehrlich
Hi there, as I want to add custom css class to table header in admin, I was looking for template, which I should edit. I found that method result_headers in django/contrib/admin/ templatetags/admin_list.py sets whole 'class="xxx"' string. Why is there 'class=' thing ? It's quiet complicated to alt

How to add non-model field in admin

2009-05-04 Thread Tomáš Ehrlich
Hi there, I wonder if is there any way to add extra input field in admin, which I don't want to define in model. For example, I want to import external files. I have simple blog model (title, content, pub_date), but in admin I want to also have file input field, to import files. Then I can: 1) I