Error running ML Code on Django

2017-06-21 Thread A.S. Khangura
I am trying to run a function from views.py which carries some Machine-Learning code. While I am loading ML model using Joblib from sklearn It throws error related to tfidf. Here is traceback: http://dpaste.com/1FPN16G -- Thanks Arshpreet Singh Python Developer Web Development/Data Science/Syste

Re: Abridged summary of django-users@googlegroups.com - 23 updates in 11 topics

2017-06-21 Thread Ranjith Kumar
Hello All, On Django admin when I tried to update the existing data I’m getting an error, AttributeError: 'str' object has no attribute '__iter__' models.py class SSPDrive(models.Model): drive_year = models.DateField(verbose_name='Drive year', null=True, b

Re: Need help for defining foreign key based on value from another table

2017-06-21 Thread Kevin Yu
I just found out on Django document, there's an example that's for manytomany, using 'through' when defining the foreign key. I think this is what i need. Here's the example: from django.db import models class Person(models.Model): name = models.CharField(max_length=128) def __str__(s

Need help for defining foreign key based on value from another table

2017-06-21 Thread Kevin Yu
I'm working with a legacy database so I have to set managed=False in the model. Here's the 3 related tables: class Branches(models.Model): name = models.CharField(max_length=128) branchpoint_str = models.CharField(max_length=255) dev_lead_id = models.IntegerField(blank=True, null=Tru

Re: Raw SQL - How to approach paging and lazy fetching

2017-06-21 Thread Kevin Yu
Thanks Jani. I was able to solve my original issue using your suggestion. On Friday, June 16, 2017 at 12:54:26 PM UTC-7, Jani Tiainen wrote: > > Yes, even there isn't real foreign keys in the database you can still > join models. > > Have been doing that few times with legacy database. When defi

django_rq or django settings issue ?

2017-06-21 Thread bonet
Hi all, I'm facing a strange behavior when trying to create Django_rq queues configuration dynamically from an environment variable. my env var is : CUSTOM_QUEUES=default:q1:q2 into my settings.py I have: from getenv import env # Cache CACHES_DEFAULT = "redis://127.0.0.1:6379/1" CACHES = {

Re: Non-primary auto-incrementing field with Postgres

2017-06-21 Thread thauk
On Tuesday, June 20, 2017 at 10:40:05 PM UTC-7, Scot Hacker wrote: > > One strategy might be to: > > 1) Bring in the data under a different column name ('old_id' ?) > 2) In a single migration, drop the default ID column, rename old_id to > id, and give it primary_key=True > I can't change the p

Re: import different entries using filter

2017-06-21 Thread Derek
Your clue is in the word "variable" that you used. The "variables" for a Django model are its fields; so what you are looking for is a value stored in your model's field. e.g. service = food.objects.get(restaurant-name__icontains='burger-place').values_list('type_of_service', flat=True) T

Re: User Based role in Django

2017-06-21 Thread Jani Tiainen
Hi, User can't upgrade his group. It is your code that does it. And it is your code responsibility to track changes etc. User just may have a button on ui that invokes your code (view) but rest is really up to you. 21.6.2017 11.24 "Mannu Gupta" kirjoitti: > I meant that using your method i.e b

Re: Non-primary auto-incrementing field with Postgres

2017-06-21 Thread Melvyn Sopacua
On Monday 19 June 2017 16:29:48 Thomas Hauk wrote: > I am working on a project that uses Django 1.10.5 with Postgres 9.6 > (and Python 3.6.1). > > I am currently migrating historical data from an old system into the > new system. This historical data has a table with a (non-primary key) > "ID" col

Django Import/Export ManyTo Many

2017-06-21 Thread 'dtdave' via Django users
I have a model with a manytomany field as follows: contact = ChainedManyToManyField( 'contacts.Contact', chained_field="practice", chained_model_field="practice", ) Within my admin I have the following for import/export: contact = fields.Field(column_name='contact

Re: url patterns question

2017-06-21 Thread Melvyn Sopacua
On Tuesday 20 June 2017 18:08:02 James Schneider wrote: > > And his problem is that it does *not* match. Not that it does. > > And for that I think my statement still stands that Django is > stripping the last portion of the URL as a GET argument. I'm betting > that > requests.GET.get('abc') will

Re: User Based role in Django

2017-06-21 Thread Mannu Gupta
I meant that using your method i.e by making different groups . When he upgrade the group . How about making another table having user, his subscription level and changed_at field(which traces when he /upgrade the group ) Just want to know your suggestion . Mannu On Jun 21, 2017 1:48 PM, "Jani T

Re: User Based role in Django

2017-06-21 Thread Jani Tiainen
Well its your code, so yes if you write code that does it. It doesn't happen magically for you. 21.6.2017 11.15 "Mannu Gupta" kirjoitti: > Hi , > Will I be able to trace if user upgrde the subscription level ? > > Manni > > On Wed, Jun 21, 2017 at 1:41 PM, Jani Tiainen wrote: > >> Hi, >> >> We

Re: User Based role in Django

2017-06-21 Thread Mannu Gupta
Hi , Will I be able to trace if user upgrde the subscription level ? Manni On Wed, Jun 21, 2017 at 1:41 PM, Jani Tiainen wrote: > Hi, > > We have been using user groups for that. And then we check and filter out > based on given group(s). > > 21.6.2017 10.45 "Mannu Gupta" kirjoitti: > >> I wan

Re: User Based role in Django

2017-06-21 Thread Jani Tiainen
Hi, We have been using user groups for that. And then we check and filter out based on given group(s). 21.6.2017 10.45 "Mannu Gupta" kirjoitti: > I want to make a role based user in Django like the following :- > > User with Subscription level 0 will have some feature and some basic > fields li

User Based role in Django

2017-06-21 Thread Mannu Gupta
I want to make a role based user in Django like the following :- User with Subscription level 0 will have some feature and some basic fields like first name , last name etc. User with Subscription level 1 will have some more feature and some extra fields like tax-id , national id , nationalit

Re: Django phone number validation

2017-06-21 Thread Andréas Kühne
Hi, https://github.com/stefanfoulis/django-phonenumber-field You could probably use that library - it works against googles phonenumber library, which is the library that is used on andoid phones as well. Regards, Andréas 2017-06-21 8:18 GMT+02:00 Santosh Yelamarthi : > Hi All, > > Can anyone