Channel- Can I dynamically adjust the amount of workers?

2017-06-03 Thread Dennis Kao
*I'm trying to use Channel on my chat app & APNs(Apple Push Notification service), I'm planning to use * python manage.py runworker --only-channels = apns but the APNs will cost lots of time waiting for response and could receive bunch of message at same time, but it didn't cost much time on op

Trouble upgrading ModelField class for django 1.10

2017-06-03 Thread Alexis Roda
Hi, I have a custom ModelField (HorariField, a simple weekly timetable) written for django 1.7 and I'm trying to upgrade it to work with django 1.10, so I have removed the SubfieldBase metaclass and added the from_db_value method. The field inherits from CharField and stores Horari instances

Saving data from csv file in a database

2017-06-03 Thread Arshdeep Singh
What I want to do is a user to go to a page where he can add some objects(Model) like a hostel which has some fields, otherwise what he can do is upload a CSV file and what I will do is accept upload of that CSV file and save data in a database. I have been trying to do this for past two days s

Re: Trouble upgrading ModelField class for django 1.10

2017-06-03 Thread Simon Charette
Hello Alexis, As you've noticed Django 1.8 changed values()/values_list() to converts values returned from the database just like any other ORM method[0]. If you want to use the json module to serialize your horari.Horari instances you'll have to define your own JSONEncoder (or DjangoJSONEncode

Re: Inconsistency of clean method

2017-06-03 Thread Tim Graham
Here's the commit: https://github.com/django/django/commit/fb1dd6b1 I can't find any related discussions but I think the reason is because the return was unnecessarily boilerplate in a lot of cases. I'm not sure what behavior change for formsets you're proposing. Which method in Django would ch

Re: Trouble upgrading ModelField class for django 1.10

2017-06-03 Thread Alexis Roda
El 03/06/17 a les 16:27, Simon Charette ha escrit: Hello Alexis, As you've noticed Django 1.8 changed values()/values_list() to converts values returned from the database just like any other ORM method[0]. If you want to use the json module to serialize your horari.Horari instances you'll ha

Re: Channel- Can I dynamically adjust the amount of workers?

2017-06-03 Thread Andrew Godwin
Hi Dennis, You can scale the number of workers using something designed for that sort of auto-scaling - you just need an image that runs a worker and something that knows how to launch and stop those images on whatever platform you're using (AWS, Google Cloud, Kubernetes, Docker, Nomad, etc.). It'

Django URL dispacher

2017-06-03 Thread Domagoj Kovač
Hi Everybody, I have a question. Lets say i have two routes routes like this: url(r'^(?P[\w-]+)/$', views.view_article_category, name="article-category"), url(r'^(?P[\w-]+)/$', views.view_product_category, name="product-category"), Lets say that i have a article_category called news and prod

Re: Django URL dispacher

2017-06-03 Thread Domagoj Kovač
I must admin my second example is not that valid. Because i would actually do it like this: 1. on /about-us route - display about us page 2. on /news/ route - display news list page - list pages would finish with the slash - so i would not have that problem. But lets say there is not slash on ne

Re: Django URL dispacher

2017-06-03 Thread Melvyn Sopacua
On Saturday 03 June 2017 13:57:54 Domagoj KovaÄ wrote: > url(r'^(?P[\w-]+)/$', > views.view_article_category, name="article-category"), > > url(r'^(?P[\w-]+)/$', > views.view_product_category, name="product-category"), > > > Lets say that i have a article_category called news and product > cat

Re: Django URL dispacher

2017-06-03 Thread Domagoj Kovač
Yes, you are right. Sometimes i get the idea in my head that after some thought actually does not make sense :). I would just add product prefix, this is a good solution. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from thi

Combining querysets while maintaining desired ordering?

2017-06-03 Thread Richard Brockie
Hi, I am combining querysets of the same model in the following manner: class ExampleModel(models.Model): many_field1 = models.ManyToManyField('Model', related_name='name1') many_field2 = models.ManyToManyField('Model', related_name='name2') def combined_many_fields(self): qs

Re: Combining querysets while maintaining desired ordering?

2017-06-03 Thread Simon Charette
Hello Richard, Since Django 1.11 you should be able to use the QuerySet.union() method[0] for that. queryset = self.many_field1.order_by('some', 'fields') combined = queryset.union(self.many_field2.order_by('some', 'fields')) Best, Simon [0] https://docs.djangoproject.com/en/1.11/ref/models/qu

Re: Combining querysets while maintaining desired ordering?

2017-06-03 Thread Richard Brockie
Hi Simon, Thanks for the clarification of the operation of the .union() method - the operative phrase in the docs appears to be "combine the results of two or more QuerySets" - perfect! My project is currently using 1.8 LTS - I can defer this until I roll forward to 1.11 LTS (hopefully sometime s