Django makemigration polls error

2018-07-24 Thread Ashish Kumar
I am trying to follow the latest Django tutorial at the documentation and I faced the following error when I enter python manage.py makemigrations polls Traceback (most recent call last): File "manage.py", line 15, in execute_from_command_line(sys.argv) File

Optimizing Prefetch for Postgres IN Limit

2018-07-24 Thread Ram Jayaraman
Is there a prescribed pattern to optimize Prefetches when the expected Prefetch list is known to exceed 100 ? We are on Django 1.8 + Postgres 10. PG has a limit of 100 for values in IN queries after which the Index on the said column is not used. For ex: a typical Prefetch generating an IN

Please ignore [Was: Hidden fields]

2018-07-24 Thread Mike Dewhirst
Sorry to bother you. Just discovered the HiddenInput widget. M On 24/07/2018 5:40 PM, Mike Dewhirst wrote: show_hidden_initial is an undocumented API feature. It defaults to False. Is the correct way to specify a field as hidden in Django to make that attribute True in the form? Thanks

installing virtualenv help 'main' errors

2018-07-24 Thread Peter Gray-Read
Greetings ... I'm just starting out... I am trying to install ‘virtualenv’ on my windows 8 laptop so I can use a tutorial to learn DJANGO. I’ve spent about 2 days trying alternatives… desperate for help… thanks I’ve tried using pip in many variations… I ALWAYS get the error message:

Re: How to automatically fill out an auto increment number in form field?

2018-07-24 Thread Alexander Joseph
For future reference - I had to change my function to def get_po_number(): last_po = PurchaseOrder.objects.order_by('po_number').last() if last_po: last_po_num = last_po.po_number new_po_num = last_po_num + 1 else: new_po_num = '1' po_number = new_po_num

syntax error

2018-07-24 Thread deepali pandey
$ python -m django --version showing syntax error? also i am unable to create a file.. i am using python 3.7 and django is already installed in my system, version of django is 2.0.7(which is compatible with python 3.7 -- You received this message because you are subscribed to the Google Groups

Re: Connecting to remote host like Twitch to monitor chat using websockets

2018-07-24 Thread Andrew Godwin
Hi Dave, It depends on what the protocol for the chat room is, but Channels is more for hosting websocket-based applications than consuming them. I suspect you would be better off looking at websocket client libraries, if the chat socket is even accessible. Andrew On Mon, Jul 23, 2018 at 4:45

How to fill empty months using Django queryset

2018-07-24 Thread Charles Sartori
I have the following: In [39]: from django.db.models.functions import TruncDate ...: p = Purchase.objects \ ...: .annotate(date=TruncDate('event_date')) \ ...: .values('date') \ ...: .annotate(total=Sum('quantity')) \ ...: .order_by('event_date') ...:

User Authenticated in Gunicorn and Daphne

2018-07-24 Thread dario . heinisch
Hi there, ideally I would like to run Daphne alongside Gunicorn and not Daphne alone: - My chat with Daphne - Rest of the website with Gunicorn A user logs in - request via Gunicorn. Now when he connects with the chat I get an AnonymousUser using self.scope['user']. This is a problem because

Django signals created kwargs is True while updating

2018-07-24 Thread Aamu Padi
I think I am missing something here, but here it goes. I have a model, and it is a sender for a post_save signal. class Book(models.Model): ... created_at = models.DateTimeField(default=timezone.now) bought = models.BooleanField(default=False) @receiver(post_save, sender=Book) def

Re: Code vs Shell?

2018-07-24 Thread roflcopterpaul
Thank you very much for the responses, everyone. Understanding *why* I've been having to work in the shell makes a lot more sense. Currently, my primary goal of learning Python is for web applications/websites, so I definitely want to learn how to do it all in the code itself, but I'm sure

Re: Code vs Shell?

2018-07-24 Thread C. Kirby
With all respect to the other answers, they don't answer what you are asking. The documentation has you interacting with the shell because django uses a database. In order to interact with the database you have to have an instance of your app running - in this case via the shell. In a future

How to get multiple entries for ManyToMany relations in filter_horizontal Admin

2018-07-24 Thread Christian Merlau
Hey, I am trying to solve following problem and I got stuck. Any help is appreciated... I have two models which represent a product and its parts. class Product(models.Model): name = models.CharField(max_length=200) average_daily = models.FloatField(default=0) average_monthly =

Re: How to make the column "user" to be auto selected in a form.

2018-07-24 Thread Mikhailo Keda
you need to set initial in admin.py for this field, check this example - https://bitbucket.org/voron-raven/maps/src/004eaa07612fd44b398dfdc61b5f9cb29ad23668/core/admin.py#lines-39 if it's not admin page - you need to pass initial to your Model form -

Re: How to install django if user is using spyder

2018-07-24 Thread Akhil Reddy
Hello guys I'm using spyder it contain python 3.6 so how I can I install django Please help me On Tue 24 Jul, 2018 6:46 pm John Son, wrote: > *models.py* > class Post(models.Model): > title = models.CharField(max_length=200) > body = models.TextField() > user =

Re: python manage.py inspectdb > models.py crashing with KeyError: options['no-color']

2018-07-24 Thread Mikhailo Keda
what version of django are you using? On Tue, Jul 24, 2018 at 11:05 AM, dean raemaekers wrote: > Hello, > > I am trying to use inspectdb to generate models for a legacy database. I > get the following error: > > $ python custom_inspectdb.py > > Traceback (most recent call last): > File

How to make the column "user" to be auto selected in a form.

2018-07-24 Thread John Son
*models.py* class Post(models.Model): title = models.CharField(max_length=200) body = models.TextField() user = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True) date = models.DateField(default=datetime.now, blank=True) text_author =

Re: Server complete html Static App without apache server and without modifying html code

2018-07-24 Thread Kasper Laudrup
Hi Archit, On 2018-07-23 20:09, archit mehta wrote: I have oraclejet frontend application and want to server that using django, I did it with flask but don't know how to do with django. Here is complete description of my problem Please go through it and suggest some solution.

python manage.py inspectdb > models.py crashing with KeyError: options['no-color']

2018-07-24 Thread dean raemaekers
Hello, I am trying to use inspectdb to generate models for a legacy database. I get the following error: $ python custom_inspectdb.py Traceback (most recent call last): File "custom_inspectdb.py", line 8, in Command().execute(table_name_filter=lambda table_name: table_name in tables,

Re: Prevent Django tests from accessing internet (except localhost)

2018-07-24 Thread Derek
Have a switch that is set to OFF by default (then your tests will switch to using a mocked approach) and then have test that can only be be run with direct access to the API if you deliberately set it ON. No "accidents". On Tuesday, 24 July 2018 04:21:07 UTC+2, Kum wrote: > > Is there a way to

Hidden fields

2018-07-24 Thread Mike Dewhirst
show_hidden_initial is an undocumented API feature. It defaults to False. Is the correct way to specify a field as hidden in Django to make that attribute True in the form? Thanks Mike -- You received this message because you are subscribed to the Google Groups "Django users" group. To