Adding a attribute to a model property

2017-06-07 Thread Bernd Wechner
I'm a tad stuck getting my head around decorating a decorator and how to do this well. But here is a proforma model: class Thing(models.Model): my_field = models.CharField('My Field') @property def my_property(self) do stuff ... return so

Re: Django graceful database errors

2017-06-07 Thread Antonis Christofides
Hi, not answering exactly what you asked, by my 2 cents anyway: Why do you want to do this? Why does the user care whether the error was in the database or a bug in your program or a filesystem error or a network error or Redis being down or whatever? Neither is this information useful nor is it

Re: Django graceful database errors

2017-06-07 Thread Melvyn Sopacua
On Wednesday 07 June 2017 16:19:46 Damian Myerscough wrote: > When trying this using the Django test web server I am still unable to > catch this error. When try the same query > using a shell I can catch the exception. > The above exception ((2003, "Can't connect to MySQL server on > '127.0.0.1'

Re: Extending the user model and accessing fields in template context

2017-06-07 Thread Bernd Wechner
Why thank you Melvyn, nailed it one. I had assumed there was a profile connected but alas it was not set ... once I set it, the template access through the dot notation to the profile works fine. It is the silent exception being ignored that threw me guess. Arguably appropriate response to a l

Re: Extending the user model and accessing fields in template context

2017-06-07 Thread Melvyn Sopacua
On Thursday 08 June 2017 08:46:38 Bernd Wechner wrote: > Have failed to find an easy answer to this so will lazily ask the > broader community before I retire tonight ;-). > > I have a model that I use to extend the User model like yo: > > from django.contrib.auth.models import User > >

Re: Django graceful database errors

2017-06-07 Thread Damian Myerscough
When trying this using the Django test web server I am still unable to catch this error. When try the same query using a shell I can catch the exception. --- Environment: Request Method: GET Request URL: http://127.0.0.1:8000/accounts/register/ Django Version: 1.11 Python Version: 3.6.0 Insta

Extending the user model and accessing fields in template context

2017-06-07 Thread Bernd Wechner
Have failed to find an easy answer to this so will lazily ask the broader community before I retire tonight ;-). I have a model that I use to extend the User model like yo: from django.contrib.auth.models import User class Dude(models.Model): nickname = models.CharField('Nickname

Is this a bug on annotate+filter+annotate over M2M field.

2017-06-07 Thread Todor Velichkov
Hello, everyone, I just want to get some more feedback on this, before posting it into the tracker. So according to the docs , the order of *annotate* and *filter* matters, since they are not c

Re: Stripe Not Returning Token (test mode)

2017-06-07 Thread Dennis Mutyaba
hi chris please i need your hand here i am geting the same problem dennis On Thursday, 16 June 2016 20:20:22 UTC+1, Chris Kavanagh wrote: > > *Stripe Not Returning Token (test mode)* > > I'm trying out Stripe in test mode on a site I'm building, and for some > reason Stripe won't return a toke

Re: How to Add radio selection in tabularInline - admin

2017-06-07 Thread Melvyn Sopacua
On Wednesday 07 June 2017 01:55:01 Pavan Kumar Polineni wrote: > class Answer(models.Model): > question = models.ForeignKey(Question) > choice_text = models.CharField(max_length=200) > answer = models.BooleanField(default=False) ^ What is that field supposed to be? Is it the "correct

Re: Django graceful database errors

2017-06-07 Thread Melvyn Sopacua
On Wednesday 07 June 2017 00:15:29 Damian Myerscough wrote: > For example, if the ORM cannot query the database I would like to > return a custom error message. > > > ==> gunicorn.log <== > [2017-06-07 06:06:01 +] [13] [DEBUG] GET /incidents/ > [2017-06-07 06:06:11 +] [8] [CRITICAL] WORK

RE: Install Django

2017-06-07 Thread Matthew Pava
You need to activate your virtual environment and then run “pip install django.” D:/Project/Pyton/lalala/activate.bat pip install django From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of sadri ashari Sent: Wednesday, June 7, 2017 2:34 AM To: Django users Subj

Re: Install Django

2017-06-07 Thread Александр Христюхин (roboslone)
It has nothing to do with pytz. The issue is that you're trying to install packages into system's python. You shouldn't do it ever. Use virtualenv instead: https://virtualenv.pypa.io/en/stable/ > On 7 Jun 2017, at 10:34, sadri ashari wrote: > > >

Django graceful database errors

2017-06-07 Thread Damian Myerscough
Hello, I have setup a Django project that is being served via Nginx + gunicorn, however, I would like to handle graceful database failures. For example, if the ORM cannot query the database I would like to return a custom error message. ==> gunicorn.log <== [2017-06-07 06:06:01 +] [13] [DE

Install Django

2017-06-07 Thread sadri ashari
please help me, i cant install django, if i install it always stack in collecting pytz package.. what's wrong ? -- You received this message because you are

How to Add radio selection in tabularInline - admin

2017-06-07 Thread Pavan Kumar Polineni
Hi, First see my models.py and admin.py before going into problem. models.py :: class Question(models.Model): question_text = models.CharField(max_length=128) topic = models.ForeignKey(Topic) category = models.CharField(max_length=20, choices=CATEGORY_CHOICES, default='Exam') s

Re: SingleObjectMixin docs Typo?

2017-06-07 Thread Tim Graham
I work on Django full time as part of the Django fellowship program, https://www.djangoproject.com/fundraising/#fellowship-program. On Wednesday, June 7, 2017 at 2:45:29 AM UTC-4, guettli wrote: > > Hi Tim, > > I am curious. Is this your leisure or your job? > > Nevertheless: Thank you very much

Re: Django Channels and Background Processes

2017-06-07 Thread Markus Schaber
Hi, Andrew, We intended to implemen the pool in the "Background Processes" mentioned on https://blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django. Apart from persiste

Re: Django in Production and Virtualenv

2017-06-07 Thread Melvyn Sopacua
On Tuesday 06 June 2017 19:08:10 Bruce Whealton wrote: > 2) How do I get an IDE like Pycharm to recognize the Virtualenv? I > know I can select the compiler Interpreter. > to be inside the > Virtualenv but other libraries that I installed into that virtualenv, > if the virtualenv is not active

Re: makemigrations running for all apps defined in INSTALLED_APPS

2017-06-07 Thread Melvyn Sopacua
On Tuesday 06 June 2017 22:43:46 Priyanka Thakur wrote: > Nothing helps till now !! I'm going to guess, that marking a managed model as unmanaged, is a migration that needs to be done to keep a consistent migration history. So first, make only that change and make the migration for it. Then ch