Re: Building correct queryset

2017-05-25 Thread Melvyn Sopacua
On Monday 22 May 2017 15:26:59 Todor Velichkov wrote: > Hello, Дмитрий, > you can try this one, but w/o further optimizations it may be a very > slow query. > > qs = Product.objects.filter( > #Where score is greater or equal > #to the 4th max score from its group >

Re: best practices for handling charts

2017-05-25 Thread Melvyn Sopacua
On Tuesday 23 May 2017 06:25:16 Alceu Rodrigues de Freitas Junior wrote: > (which will > require that I use crontab or something like it to delete old files). Which is a one-liner: find /var/www/generated-graphs -mtime 14 -delete # delete 2- week old files Some solutions are easier then the

Re: null value in column violates not-null constraint

2017-05-25 Thread Melvyn Sopacua
Let me spell it out: If the error message complains about the user field And the code you provided is correct Then your database is out of sync with your model definition On Thursday 25 May 2017 13:53:19 Ismail Sarenkapic wrote: > Tnx , > I know that i can manually select

Re: null value in column violates not-null constraint

2017-05-25 Thread Vijay Khemlani
"form.instance.user" should be "form.instance.seller" But the "null value in column" error could also apply to any of the non-nullable fields in your Product model that are not set by the time you save the instance. On 5/25/17, Ismail Sarenkapic wrote: > Tnx. > The slug

Re: null value in column violates not-null constraint

2017-05-25 Thread Ismail Sarenkapic
Tnx. The slug is not important here. The main question is how do I add product with current user! On Thursday, May 25, 2017 at 8:00:08 PM UTC+2, Muhammad wrote: > > Ismail, > > You don't seem to be handling the value for Product.slug anywhere, either > in the model or the view. > > You can fix

Re: null value in column violates not-null constraint

2017-05-25 Thread Ismail Sarenkapic
Tnx , I know that i can manually select the user, but i want it to be automatic-with current user to add the product On Thursday, May 25, 2017 at 7:13:39 PM UTC+2, Melvyn Sopacua wrote: > > On Thursday 25 May 2017 04:19:56 Ismail Sarenkapic wrote: > > > Hi, I'm trying to create a digital

Django 1.11: JSONField loaded as string during migration's RunPython

2017-05-25 Thread hector . urbina
Hello, We are moving to Django 1.11, but we have some models with JSONField fields, which are being used on some custom migration functions (called with RunPython). We're getting the following kind of errors: _ForecastType = apps.get_model('forecast', 'forecasttype') for forecast_type

Ory editor integration

2017-05-25 Thread Jamesie Pic
Hi all, I found this new WYSIWYG promising: https://github.com/ory/editor Anybody already working on integration of ORY editor with Django ? Thanks ! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: Custom Model Manager

2017-05-25 Thread 'David Turner' via Django users
Apologies I was being really a bit too clever. I just need to put the deault manager first in my model and then use my custom manager in my view queryset and everything is fine. On 25 May 2017 at 18:01, David Turner wrote: > That would be fine if I was using 1.10 but

Re: saving data from both a model and a derived model

2017-05-25 Thread James Schneider
On Wed, May 24, 2017 at 11:03 AM, Jim Anderson wrote: > Hi James, > > I'm attaching the stacktrace as you requested. > > Thanks. It is quite telling: File "/home/jja/testenv3.5/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 337, in execute

Re: null value in column violates not-null constraint

2017-05-25 Thread Muhammad M
Ismail, You don't seem to be handling the value for Product.slug anywhere, either in the model or the view. You can fix the slug issue by overriding the Product model's save () method like this: def save (self, *args, **kwargs): if not self.slug: self.slug = slugify(self.title)

Re: null value in column violates not-null constraint

2017-05-25 Thread Melvyn Sopacua
On Thursday 25 May 2017 04:19:56 Ismail Sarenkapic wrote: > Hi, I'm trying to create a digital marketplace site where users will > be able to register and submit their products. > I created the Product model and connected it with User with foreign > key.Everything seems to be alright, but when I

Re: Custom Model Manager

2017-05-25 Thread 'David Turner' via Django users
That would be fine if I was using 1.10 but this is a legacy system using 1.9. This will be upgraded in the foreseeable future to 1.11 Thanks On 25 May 2017 at 17:01, Melvyn Sopacua wrote: > On Thursday 25 May 2017 08:37:32 'dtdave' via Django users wrote: > > > > > My

Re: Custom Model Manager

2017-05-25 Thread Melvyn Sopacua
On Thursday 25 May 2017 08:37:32 'dtdave' via Django users wrote: > My application model has fields for candidate and jobs. > My problem is that once the job expires it is being dropped from both > the candidates and the applications as obviously the expired items > manager is the default. > Any

Custom Model Manager

2017-05-25 Thread 'dtdave' via Django users
I apologise if this is a simple question but I am still somewhat new to Dajngo. I have the following models: Jobs Model Candidates Model Applications Model The jobs model has a manager on it as follows: class ExpiredManager(models.Manager): def get_queryset(self): return

Re: Connecting django to postgresql database

2017-05-25 Thread Daniel Roseman
On Thursday, 25 May 2017 12:48:32 UTC+1, Njogu wrote: > > > however when i run the command *'python manage.py migrate'* it does not > identify the word migrate, and when i run the command '*python manage.py > syncdb*' i get the following error; > syncdb has not existed in Django since version

Re: Connecting django to postgresql database

2017-05-25 Thread Antonis Christofides
Hello, 1) You say that "it does not identify the word migrate". Could you please show us the exact error message? 2) The message you are getting, "psycopg2_version 2.5.4 or newer is required; you have 2.4.5" seems perfectly clear. Could you elaborate on why you have trouble correcting it?

Connecting django to postgresql database

2017-05-25 Thread Njogu
I have been trying to connect my django project to postrgesql database, i have one the configurations to it perfectly like this; ALLOWED_HOSTS = ['localhost', '127.0.0.1'] DATABASES = { 'default': { 'ENGINE' : 'django.db.backends.postgresql_psycopg2', 'NAME' :

null value in column violates not-null constraint

2017-05-25 Thread Ismail Sarenkapic
Hi, I'm trying to create a digital marketplace site where users will be able to register and submit their products. I created the Product model and connected it with User with foreign key.Everything seems to be alright, but when I submit my product i get the following error: null value in

Re: CPU usage by workers

2017-05-25 Thread qnub
For those who have same CPU usage issue — my mistake was in isage RedisLocalChannelLayer in combo with delay server. Looks like many delayed messages just hangs on nodes. I've thought it should be executed on same node, but seems partially it was consumed, but partially hangs. Then i've tried

Re: Django+Haystack+Elastic issue

2017-05-25 Thread Nick Gilmour
It is related with Django's pagination... The results per page value can be set with: HAYSTACK_SEARCH_RESULTS_PER_PAGE = 20 in the settings.py. I had found and defined this setting before but it wasn't working because I had this in the HAYSTACK_CONNECTIONS dict (don't ask me why...). I have