Re: Django sending syntax errors on ES syntax of imported JS file

2018-03-01 Thread Jani Tiainen
Hi, looks like you're using original typed library which is written in ES and it's not very well supported among the browsers. You should pick transpiled version from lib-directory, that should work with all browsers without problems. On Fri, Mar 2, 2018 at 8:32 AM, lakeshow

Django sending syntax errors on ES syntax of imported JS file

2018-03-01 Thread lakeshow
I'm attempting to use the script of a third party JS library: {% block javascript %} ...{% endblock javascript %} Doing so will return an error: `Uncaught SyntaxError: Enexpected token {` And this error refers to line 1 of 'typed.js', more specifically, this line of JS code:

Re: Channels 2: Consumer running twice when two users simultaneously share socket

2018-03-01 Thread lakeshow
You're absolutely correct. Much appreciated, Andrew! On Friday, March 2, 2018 at 3:08:37 PM UTC+9, Andrew Godwin wrote: > > The problem appears to be that you are saving to the database inside the > chat_message handler - since you're sending a message of type > "chat.message" to the group,

Re: Channels 2: Consumer running twice when two users simultaneously share socket

2018-03-01 Thread Andrew Godwin
The problem appears to be that you are saving to the database inside the chat_message handler - since you're sending a message of type "chat.message" to the group, that means everything in the group is going to receive the message, run that handler, and save (so with 2 connected you get 2 saves,

Re: Channels 2: Consumer running twice when two users simultaneously share socket

2018-03-01 Thread lakeshow
Sure. The JS code is essentially identical to your example. By "two users connected", I simply meant two users have clicked to join in a chatroom by way of `socket.send()`. I've tested it by using two different browsers and having users log in to join the same room. When they are both

Re: How to access the key attributes of a model

2018-03-01 Thread Dylan Reinhold
That seems right. Do you get an error, or just no data in the url? You should also look into the slugify helper, https://docs.djangoproject.com/en/2.0/ref/utils/#django.utils.text.slugify Dylan On Thu, Mar 1, 2018 at 2:37 PM, Alberto Sanmartin < albertosanmartinmarti...@gmail.com> wrote: > This

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-03-01 Thread Bernd Wechner
Good news is that Django 2.0 is out and does support the Window functions: https://docs.djangoproject.com/en/2.0/ref/models/database-functions/#lag Though it will mean a) upgrading on my dev box, c) working out how to use it and if happy, c) upgrading on my production box and rolling it out.

Re: ChoiceField avec valeur cochée par défaut

2018-03-01 Thread Simon Charette
Bonsoir Niche, Tu devrais être en mesure d'y arriver en t'assurant que le formulaire (Form) comprenant ce champ ait ta valeur ta valeur par défaut comme initial data. exemple class MyForm(forms.Form): field = ChoiceField(widget=widgets.RadioSelect, choices=['un', 'deux', 'trois']) form =

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-03-01 Thread Bernd Wechner
I too have a hard time envisioning the SQL, so yes, I tried that. Haven't got past the one I cited in first post yet: https://dba.stackexchange.com/questions/53862/select-next-and-previous-rows but it contains

How to access the key attributes of a model

2018-03-01 Thread Alberto Sanmartin
This is mi code: models.py: @autoconnect class Category(models.Model): name = models.CharField(max_length=100) slug = models.CharField(max_length=100, blank=True) description = models.CharField(max_length=200) creation_date = models.DateTimeField(auto_now_add=True) def

Re: Channels 2: Consumer running twice when two users simultaneously share socket

2018-03-01 Thread Andrew Godwin
Can you clarify what you mean by "two users connected to the same socket"? If you have two websockets connected, you'll have two copies of your consumer running, one for each socket. Andrew On Thu, Mar 1, 2018 at 7:52 AM, lakeshow wrote: > I am running into an issue using

Re: Channels: channel_layer appears to time out

2018-03-01 Thread Andrew Godwin
Hi Toby, Do you have the latest versions of daphne, channels, asgiref and channels_redis? This sounds supiciously like a bug I fixed a couple weeks ago. Andrew On Thu, Mar 1, 2018 at 5:45 AM, wrote: > Hello, > > I have a project that uses Channels as a worker queue, with a

Channels 2: Consumer running twice when two users simultaneously share socket

2018-03-01 Thread lakeshow
I am running into an issue using Channels where if two users are connected to the same socket, the consumer will run twice. When a single user is connected, only once. So in practice: when I have two users chatting with each other over channels, a single sent message will be run through the

ChoiceField avec valeur cochée par défaut

2018-03-01 Thread Niche
Bonjour! comment faire pour avoir un radiobox (ChoiceField) coché avec une valeur par defaut ? -- 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

Re: 'ModelFormOptions' object has no attribute 'label'

2018-03-01 Thread Anup Yadav
Could you solve this issue? May I know what was the issue? I'm facing this issue right now. On Monday, August 21, 2017 at 11:41:29 AM UTC+5:30, Lachlan Musicman wrote: > > Hi All, > > I'm seeing this error when I start my uwsgi > > > > > Exception Type: AttributeError Exception Value: > > > >

Channels: channel_layer appears to time out

2018-03-01 Thread operator
Hello, I have a project that uses Channels as a worker queue, with a SyncConsumer that runs a heavy computation task. This works great. I transitioned the project to have a 'task in process' page that opens a websocket and through the magic of channel's groups it gets pushed the computation

Re: UUIDs eventually choke as primary key

2018-03-01 Thread M Mackey
I added some debug support, and there are only two classes called UUID when this fails: uuid UUID: psycopg2.extensions UUID: The psycopg extension is a converter, and it seems highly unlikely that it was put into place as the value, and I doubt it would report it's __str__ as the UUID

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-03-01 Thread C. Kirby
I'm having a hard time envisioning the SQL statement that could do what you are asking, without a sub select or something like that. If you can write the expression in sql you _might_ be able to get back to the ORM that would create that. Can you provide an sql statement that does what you

Re: Trying to create a CBV that allows user to copy a record

2018-03-01 Thread Alexander Joseph
Thanks! On Wednesday, February 28, 2018 at 11:53:01 AM UTC-7, Dylan Reinhold wrote: > > Use the get_inital method. > > def get_initial(self): > initial = super(MyCreateView, self).get_initial() > initial['name'] = 'Testing' > return initial > > Dylan > > > > On Wed,

Re: Is there a way to make a field both foreignKey or allow user to fill it in themself?

2018-03-01 Thread Alexander Joseph
I think the solution is above my head at the moment. I'll have to look back into it once I get better at Django. Thanks for your help though On Tuesday, February 27, 2018 at 7:26:22 AM UTC-7, Alexander Joseph wrote: > > Is there a way to make a form field or model field either a foreign key >

Re: OuterRef not being treated as an F Expression

2018-03-01 Thread Michael Barr
For what it is worth, it has been confirmed as a bug and fixed: https://code.djangoproject.com/ticket/29142 On Friday, February 9, 2018 at 7:52:50 AM UTC-5, Michael Barr wrote: > > According to the documentation on models.OuterRef >

Re: Help needed - new very first django App

2018-03-01 Thread Jayaram Namburaj
Hi Kasper, Thanks for your findings. It is working now as per your suggestion. Regards JayaramN On Wednesday, February 28, 2018 at 11:41:27 PM UTC+5:30, Kasper Laudrup wrote: > > Hi Jayaram, > > On 2018-02-28 15:45, Jayaram Namburaj wrote: > > > > When running the url

GSOC WITH DJANGO

2018-03-01 Thread tola temitope
hey, good day guys i am a Django developer thats been building for almost a year now and i am participating with gsoc this year with django, I want to improve my skills, solve problems and build the community too. -- You received this message because you are subscribed to the Google Groups

Re: django-channels: WebSocketBridge options

2018-03-01 Thread nferrari
Understood! Thank you On Wednesday, February 28, 2018 at 6:30:45 PM UTC+1, nferrari wrote: > > Hello, > > It seems that it is not possible to pass options to ReconnectingWebsocket > through WebSocketBridge. I'd like to do able to do so, like it's possible > with ReconnectingWebsocket >

Re: When do I need a new app within the site?

2018-03-01 Thread Derek
Mike Dewhirst wrote: *I also have a "common" app to contain bits and pieces like utilities ...* I don't keep these under apps; my project-wide utility-type code (code without Django Models) sits under a "utils" module (with further namespaces as needed), at the same level as "apps" This means

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-03-01 Thread Mike Dewhirst
On 1/03/2018 5:44 PM, Bernd Wechner wrote: Mike, Yep, adding pk as a final tie breaker is trivial, but not the issue ;-). Alas adding a sequencing field is not an option because I am looking for a generic solution, akin to what the admin site on Django offers, I have a model browser that I