Re: Dynamically adding a field to a model - via contribute_to_class

2017-09-13 Thread Melvyn Sopacua
If I may suggest a better approach: - Make the code as ImageField does (see it's width_field and height_field) - Then focus on writing the migration for this field Unfortunately, I don't see a way for custom fields to provide hints to the migrations framework. So a field that automatically

Re: More bizarre URL behaviour after deploying

2017-09-13 Thread Antonis Christofides
That particular issue may be a lighttpd issue, but my question is more general. Unfortunately I don't remember the kind of trouble I was having with uwsgi. Are there any people who have used both uwsgi and gunicorn and have a preference for the former? What benefits have they seen? Antonis

Re: FROM ONLY in Postgres back-end

2017-09-13 Thread Christian Ledermann
On 12 September 2017 at 14:32, Andrew Hankinson wrote: > Hello, > > tl;dr I'm trying to implement 'temporal tables' [0] in Django with a > Postgres backend, and I'm stuck on how to generate the appropriate SELECT > ... FROM ONLY and UPDATE queries. > > The temporal

Re: More bizarre URL behaviour after deploying

2017-09-13 Thread Antonis Christofides
> Alas it's a tad complicated and I'll try and publish a module with the fix > some time soon (it relates to lighttpd, uwsgi, django interactions and the > management of SCRIPT_NAME and PATH_INFO environment variables which lighttpd > doesn't do to Django's satisfaction and so it needs tweaking

Re: More bizarre URL behaviour after deploying

2017-09-13 Thread Melvyn Sopacua
You're missing the fact that it's the scgi module of lighttpd is what is causing it. uwsgi shouldn't fix it, as it has no idea if this is intentional, for example when using mounts [1]. As can be seen in the WSGI spec, the WSGI client (uwsgi / gunicorn / whathaveyou) should trust what is provided

Re: Migration Woes: TypeError: int() argument must be a string... on ForeignKeys

2017-09-13 Thread Melvyn Sopacua
The issue didn't crop up, because there were no rows when you added the field, so default isn't called. If you had existing data, then it would've triggered. What default should return for foreign keys is actually documented: > For fields like ForeignKey that map to model instances, defaults

RE: FROM ONLY in Postgres back-end

2017-09-13 Thread Matthew Pava
If you want to do auditing of the database, I would look at packages available for Django. This is the first I've read about "temporal tables," and my first impression is that of grave concern. Django-reversion is a popular package: https://github.com/etianen/django-reversion -Original

Re: FROM ONLY in Postgres back-end

2017-09-13 Thread Andrew Hankinson
Thanks for your replies. I have looked at the other options available. While they are suitable for version control, they're not well suited for queries where you want to see the state of a given object at a given time. "Show me what X looked like on Y date" can be useful, and shouldn't require

Re: More bizarre URL behaviour after deploying

2017-09-13 Thread Bernd Wechner
Antonis, Well truth be told I'm with uwsgi only because of the snowball effect you're alluding to, namely we have so many options I'm like looking on-line for what the most popular and recommended one is, and uwsgi has a huge fan base.  As to server, I opted for lighttpd only because I

Why does Case/When ungroup the results of my values() annotate() query?

2017-09-13 Thread Eric Palmitesta
Hey all! I've posted my question to StackOverflow and asked in #django on freenode but haven't gotten any responses, so I guess this mailing list is my next stop. https://stackoverflow.com/questions/45802068/why-does-case-when-ungroup-the-results-of-my-values-annotate-query It appears when I

Getting my head around ForeignKey, One-To-Many and Many-To-Many.

2017-09-13 Thread Jack Razors
I am creating a mindmap visio-like editor website using d3js and a bunch of custom javascript. Rather than the schema/stencils being populated by static JSON files, I wanted to create an administration area to edit the schema without requiring JSON kung-fu skills and serve the dynamically

django custom authentication

2017-09-13 Thread yingi keme
I have this code in my app view from django.shortcuts import render from django.contrib.auth.decorators import login_required @login_required(login_url="login/") def home(request): return render(request, "home.html") Here also is my project url from django.conf.urls import url, include

Re: Email validation in form

2017-09-13 Thread Moreplavec
Thanks. I made it as needed and wrote simple JS to call popup if there is an error to rise modal again after reload. Thanks! Dne úterý 12. září 2017 15:18:58 UTC+2 Daniel Roseman napsal(a): > > > On Tuesday, 12 September 2017 14:18:29 UTC+1, Daniel Roseman wrote: >> >> On Tuesday, 12 September

Re: Email validation in form

2017-09-13 Thread Melvyn Sopacua
First, make sure the field is rendered as an input tag with type "email". If it's not, your Django version is out of date or you're overriding the widget somewhere. Second, read this: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#Validation The standard pattern isn't good

Re: More bizarre URL behaviour after deploying

2017-09-13 Thread Melvyn Sopacua
Humor me and call it list_view in the pattern and template references. -- Melvyn Sopacua -- 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: More bizarre URL behaviour after deploying

2017-09-13 Thread Bernd Wechner
Well, not a lot of insight from the broader community on this one, but a warm thank you to Melvyn Sopacua who took the time to think about it a bit and apply his experience which led me to: /usr/local/lib/python3.5/dist-packages/django/urls/base.py where I could instrument Django a bit

Customized FROM clause/sort by computed annotation values

2017-09-13 Thread stschindler
Hey Django users, I'm building a quite large query set that makes use of subqueries and lots of annotations. Here's the relevant part: queryset = StockItem.objects \ .order_by() \ .annotate(available_stock_count=Subquery(stock_booking_count, output_field=IntegerField())) \

Re: Am a new Django User and am finding difficulties making a query to my database

2017-09-13 Thread Melvyn Sopacua
Well, the simplest answer is you used the python shell and not the django shell via `python manage.py shell`. The app not being in installed apps gives a slightly different error and migrations have little to do with it as importing a model doesn't hit the database. So simply use `python

Install uWSGI on cygwin

2017-09-13 Thread Dick Pan
Hi, When I install uWSGI on cygwin by command: python2.7 uwsgiconfig.py --build one strange problem occur, undefined reference to `uuid_generate' on cygwin. but uuid.h exist in /usr/include/uuid/, and I checked GCC include path by command: echo | gcc -v -x c++ -E -, it's ok. At last, I have to

Am a new Django User and am finding difficulties making a query to my database

2017-09-13 Thread Abdul-Waris Dawuda
Hello Everyone Am new to Django and am currently facing a problem trying to import a class from my models. i get this error when i try to do that from the Shell. I am using Visual Studio. i get this problem when i run my command to import; >>> from app.models import Artist Traceback (most

I AM NOT ABLE TO IMPORT CLASSES FROM MY MODELS WHEN AM TRYING TO RUN A QUERY

2017-09-13 Thread Abdul-Waris Dawuda
When i run this command in the django shell when am trying to make query to my databse i get this problem. Kindly help me out: >>>from app.models import Artist Traceback (most recent call last): File "", line 1, in File ".\app\models.py", line 8, in class Artist(models.Model): File

Re: Am a new Django User and am finding difficulties making a query to my database

2017-09-13 Thread Oladipupo Elegbede
Did you include your app in the installed apps list in your settings.py file? Did you do the makemigration and migration after creating the model? Check these two steps and then try again. That's what I'm suspecting given the error trace. On Sep 13, 2017 7:13 AM, "Abdul-Waris Dawuda"

Re: The view blog.views.create didn't return an HttpResponse object. It returned None instead.can any one help me this issue please nooob here

2017-09-13 Thread Melvyn Sopacua
And to be complete: from django.http.response import HttpResponseNotAllowed # in create else: return HttpResponseNotAllowed(['get', 'post']) On Tue, Sep 12, 2017 at 2:08 AM, Luis Zárate wrote: > if request.method == "GET": > if request.method == "POST": >

Re: Install uWSGI on cygwin

2017-09-13 Thread Avraham Serour
try using pip: 'pip install uwsgi' On Wed, Sep 13, 2017 at 11:35 AM, Dick Pan wrote: > Hi, > > When I install uWSGI on cygwin by command: python2.7 uwsgiconfig.py > --build > > one strange problem occur, undefined reference to `uuid_generate' on > cygwin. > but uuid.h

Re: Dynamically adding a field to a model - via contribute_to_class

2017-09-13 Thread Michal Petrucha
On Tue, Sep 12, 2017 at 12:34:26AM -0700, gernot.c...@gmail.com wrote: > Hi, > > I don't know if crossposting with stackoverflow is allowed here but > essentially my problem is explained > in > https://stackoverflow.com/questions/46162104/django-dynamic-model-fields-and-migrations. > What I

SystemCheckError: (admin.E111)

2017-09-13 Thread Amit Mishra
Hey, I am using python= 3.5 and Django= 1.10.2 If I am running for the makemigrations --$ python3 manage.py makemigrations OR Starting server -- $ python3 manage.py runserver 0.0.0.0:8000 Its returning errors for SystemCheckError .../mydjangoproject# python3 manage.py

Re: SystemCheckError: (admin.E111)

2017-09-13 Thread Melvyn Sopacua
What's not clear about the error? There are two admin classes that have invalid list_display_links values. The format is documented: https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display_links And chances are you have: list_display_links =

RE: Migration Woes: TypeError: int() argument must be a string... on ForeignKeys

2017-09-13 Thread Matthew Pava
Okay, after much investigation, I found that the default value on this exact field was actually a callable that returned an instance of DisplayName rather than the pk. After changing that, the migrations ran successfully. I wonder if Django could provide a better hint of such issues. It’s