Re: When to use get_user_model()

2018-02-19 Thread tango ward
Thanks Xavier On Mon, Feb 19, 2018 at 1:02 PM, Xavier Paniello wrote: > Hi tangoward15, > > Django will use auth.User as the user model in the system, unless you > change AUTH_USER_MODEL = RegUser in settings.py > > Be carefull, to change the user model has some particularities you can > read in

How do I get dynamic choices to a select widget at render time?

2018-02-19 Thread Mike Dewhirst
Here is an example of get_choices() output ... it comes from a method on the Question model.  [('A', 'A - Once?'), ('B', 'B - Twice?'), ('C', 'C - Four times?'), ('D', 'D - Twelve times?'), ('E', 'E - Continously as changes are made?')] It is available before the the answer form is instantiat

Re: Setting default foreign key value of type UUID

2018-02-19 Thread Vinicius Assef
What's the problem? On 16 February 2018 at 15:00, Dragan Mestrovik wrote: > Hi, > > I am getting issue with setting default foreign key value of type UUID. My > models are > > import uuid > from django.db import models > > # Create your models here. > class Provider(models.Model): > id = models

Attaching `ng-model` to Select widget gives "?undefined:undefined?" `option` value attribute

2018-02-19 Thread Tom Tanner
How do I solve this problem with Django and AngularJS where the first `option` on my `select` tag displays wrong? Full info: https://stackoverflow.com/questions/48872768/attaching-ng-model-to-select-widget-gives-undefinedundefined-option-val -- You received this message because you are subscrib

Re: [django-channels] Running multiple daphne servers

2018-02-19 Thread Tomáš Ehrlich
Ah, problem solved. This line forces db=0 in asgi_redis 1.x: https://github.com/django/channels_redis/blob/1.x/asgi_redis/core.py#L566 in 2.x version it seems to be fixed. Thanks again! :) > 19. 2. 2018 v 21:02, Tomáš

Re: [django-channels] Running multiple daphne servers

2018-02-19 Thread Tomáš Ehrlich
You’re absolutely right, using different prefix solves the problem. asgi_redis seems to be ignoring my connection_kwargs where I set the db. Connection_kwargs should be set like this, right? REDIS = { "hosts": [(os.environ.get('REDIS_HOST'), 6379)], "connection_kwargs": { "db": o

Re: [django-channels] Running multiple daphne servers

2018-02-19 Thread Andrew Godwin
Presuming 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 consider changing the prefix setting on the channel l

Re: Initializing DateTimeField in django forms.

2018-02-19 Thread Jani Tiainen
Hi. If you want to display only date why aren't you doing it in template rather than trying to make form to just display value. 19.2.2018 18.38 "prince gosavi" kirjoitti: > That did the job.But I would like to get rid of the 'Field' type view that > surrounds the date. As I only want to display

Re: Initializing DateTimeField in django forms.

2018-02-19 Thread prince gosavi
That did the job.But I would like to get rid of the 'Field' type view that surrounds the date. As I only want to display the date. Is there a way to do it in the form itself or any way to change it in the templates? On Monday, February 19, 2018 at 7:52:05 PM UTC+5:30, prince gosavi wrote: > > H

[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: Initializing DateTimeField in django forms.

2018-02-19 Thread Etienne Robillard
i think you need to replace: form = UserQueryForm() with form = UserQueryForm(initial={'date': date}) See: https://docs.djangoproject.com/en/2.0/ref/forms/api/ Etienne Le 2018-02-19 à 10:31, prince gosavi a écrit : | # my_app/views.py fromdjango.shortcuts importrender,get_object_or_404 #

Re: Initializing DateTimeField in django forms.

2018-02-19 Thread prince gosavi
# my_app/views.py from django.shortcuts import render, get_object_or_404 # Create your views here. from .models import User from .forms import UserQueryForm def home(request): # home page a_list = User.objects.filter() for item in a_list: context = {'username': item.username,'conta

Re: Initializing DateTimeField in django forms.

2018-02-19 Thread Etienne Robillard
How does your view looks like? Etienne Le 2018-02-19 à 09:18, prince gosavi a écrit : Hi, I am building a simple django application for user feedback. And I have created a form for that purpose. Here is the snippet: | # my_app/forms.py fromdjango importforms importdatetime classUserQueryF

Initializing DateTimeField in django forms.

2018-02-19 Thread prince gosavi
Hi, I am building a simple django application for user feedback. And I have created a form for that purpose. Here is the snippet: # my_app/forms.py from django import forms import datetime class UserQueryForm(forms.Form): date = forms.DateField(initial=datetime.date.today) # need help u

how to use two are more model query in a single function

2018-02-19 Thread arvind yadav
class MyObjectAdmin(admin.ModelAdmin): # A template for a very customized change view: change_form_template = 'admin/my_change_form.html' def get_dynamic_info(self): # ... pass def change_view(self, request, object_id, form_url='', extra_context=None): extra_context = extra_context or

Re: How can I get a message from views.py ?

2018-02-19 Thread Mike Ru
It's cool. Thank you! понедельник, 19 февраля 2018 г., 15:21:31 UTC+3 пользователь Etienne Robillard написал: > > Check this out: > https://stackoverflow.com/questions/20306981/how-do-i-integrate-ajax-with-django-applications > > Etienne > > Le 2018-02-19 à 07:12, Mike Ru a écrit : > > I don't g

Re: How can I get a message from views.py ?

2018-02-19 Thread Etienne Robillard
Check this out: https://stackoverflow.com/questions/20306981/how-do-i-integrate-ajax-with-django-applications Etienne Le 2018-02-19 à 07:12, Mike Ru a écrit : I don't get how to do it. I need to display a message "Hello world"  using  framawork messages with Jquery/Ajax I can do it without J

How can I get a message from views.py ?

2018-02-19 Thread Mike Ru
I don't get how to do it. I need to display a message "Hello world" using framawork messages with Jquery/Ajax I can do it without Jquery/Ajax but it's not good. The user clicks the link and depending on a condition or to send him according to the reference or to display the message without rebo