Re: ML-Python

2019-03-13 Thread Hafit Omar
It works thanks a lot sir,

On Wed, 13 Mar 2019, 11:35 pm Utpal Mishra,  wrote:

> You have to use "model_selection", it will work. Quite a while ago
> "cross_validation" has been replaced by" model_selection".
> For reference you can go through my code:
> https://colab.research.google.com/drive/1NliqtxZVvLhZNXhNFyXQZpwG392hcvh4
> Do inform, in any case.
>
> On Wed, Mar 13, 2019 at 5:14 PM Hafit Omar  wrote:
>
>> Hi Everyone I'm Hafit from Libya,
>> Can anyone help me in in sklearn library I want to import
>> cross_validation it doesn't work but the other like preprocessing and svm
>> it does, please it's urgent,
>> Thank you in advance
>>
>> --
>> 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 django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAP%3DccR57ZTOvdw8EUSozSOGvK2%2BzZJb6q3ocoAA%2B9Rk4FJjTbA%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAObFs%3DeC593qwhgFx30g6uqsyenhoq5Sru6F7SA0%3DLQY5pinXQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%3DccR6Mbx6WTNBVw%3DUJsb__FYn7tFx4bSRRsQLrJtqqAA84MQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-13 Thread Matthew Pava
Looking at it, I would say that this is by design. You shouldn’t use an empty 
label on a multiple choice field. Perhaps this should be clarified in the docs.
Saying that, if you really want an empty label on a multiple choice field, you 
could create your own class that initializes empty_label however you want it.

From: 'Odile Lambert' via Django users [mailto:django-users@googlegroups.com]
Sent: Wednesday, March 13, 2019 1:57 PM
To: Django users
Subject: Bug in Django 2.1 on ModelMultipleChoiceField


Hello,

I believe Bugs in Django are to be reported in this user list. Below is a 
report for a bug which does not seem to be already filed.

In the documentation reference on the ModelMultipleChoiceField there is no 
restrictios mentioned on the empty_label attribute.

Whenever you declare an attribute empy_label for a ModelMultipleChoiceField, it 
generates an error during the system_checks

 typeError " __init__() got multiple values for keyword argument 'empty_label

To reproduce the bug : :

class MyForm(forms.Form):
field = forms.ModelMultipleChoiceField(
queryset = Imodelclass.objects.all(),)
empty_label=(''))

Another user on stackoverflow encountered  this same problem see here : 
https://stackoverflow.com/questions/52263426/django-empty-label-for-modelmultiplechoicefield-multiple-values-for-keyword-arg

The cause of the error is the following :

the code ( see fdjango/forms/models.py line 1266 sets the empty_label attribute 
to None while calling the super_class (ModelChoiceField):

super().__init__(queryset, empty_label=None, **kwargs)

while the super_class.__init__ sets the empy_label to "-".

removing the empty_label= None in the call to the super_class solved the 
problem for me.

best regards

Odile Lambert

--
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 
django-users+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/063841b4-5b58-4931-6ea3-29188ccc8171%40laposte.net.
For more options, visit https://groups.google.com/d/optout.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c6be6380098a49b6bab737a85e1b5d5b%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-13 Thread 'Odile Lambert' via Django users

  
  
Hello,
I believe Bugs in Django are to be reported in this user list.
  Below is a report for a bug which does not seem to be already
  filed.

In the documentation reference on the ModelMultipleChoiceField
  there is no restrictios mentioned on the empty_label attribute. 

Whenever you declare an attribute empy_label for a
  ModelMultipleChoiceField, it generates an error during the
  system_checks

 typeError " __init__() got multiple values for keyword argument 'empty_label

To reproduce the bug : :
class MyForm(forms.Form):
      field = forms.ModelMultipleChoiceField(
      queryset = Imodelclass.objects.all(),)
      empty_label=(''))

Another user on stackoverflow encountered  this same problem see
  here :
https://stackoverflow.com/questions/52263426/django-empty-label-for-modelmultiplechoicefield-multiple-values-for-keyword-arg
  

The cause of the error is the following :

the code ( see fdjango/forms/models.py line 1266 sets the
  empty_label attribute to None while calling the super_class
  (ModelChoiceField):
super().__init__(queryset, empty_label=None, **kwargs)
while the super_class.__init__ sets the empy_label to
  "-". 

removing the empty_label= None in the call to the super_class
  solved the problem for me. 

best regards
Odile Lambert


  




-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/063841b4-5b58-4931-6ea3-29188ccc8171%40laposte.net.
For more options, visit https://groups.google.com/d/optout.


Re: Need to Store All Model data in RAM

2019-03-13 Thread Vaibhav Mishra
Hi Chetan,

Thanks ,Ok , Now I get it  :)   Will try this and share my experience.

On Wednesday, March 13, 2019 at 12:43:38 PM UTC-4, Chetan Ganji wrote:
>
> Bhai, read your original question 
>
> *"I have a table of over 100,000 rows which I need to compare with another 
> list to find if the entry matching a rows is in there or not "*
>
> Which another list were you talking about?
>
> so the another_list could be a pre-populated list of python or another 
> list made of queryset. 
>
> e.g. 
> another_list = [1, 2, 3, 4] OR
> another_list = list(Modelname.objects.all()) 
>
> I hope this clears your confusion. 
>
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji@gmail.com 
> http://ryucoder.in
>
>
> On Wed, Mar 13, 2019 at 9:32 PM Vaibhav Mishra  > wrote:
>
>> Thanks Andreas, Will try out the list Method.
>>
>> On Wednesday, March 13, 2019 at 9:58:16 AM UTC-4, Andréas Kühne wrote:
>>>
>>> Hi,
>>>
>>> You can't. The way that you are working - it would always go back to the 
>>> database - because you are using the filter methods.
>>>
>>> You would need to create a list from the items, then do the comparison 
>>> in python - which probably will be slower (but not necessarily).
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>>
>>> Den ons 13 mars 2019 kl 12:44 skrev Vaibhav Mishra :
>>>
 Hi All,

 I have a table of over 100,000 rows which I need to compare with 
 another list to find if the entry matching a rows is in there or not 

 The following does not work

 getdata = data.objects.all()


 mydata= getdata.filter(mycriteria)




 Process information and comparision from 'mydata'



 .The code .should fetch all data and should no longer go to Database. , 
 but it still seem to hit database
 .
 Whenever I am running code, I see that for each comparision , the Code 
 is Hitting the database resulting in over thousands of queries and lot of 
 delay in finishing Processing data. 

 How can I force All Data to be stored in RAM so that its no longer 
 needed to access database. ?

 -- 
 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 django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/a120e643-936e-4f6a-9662-7811808fa8cf%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> -- 
>> 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 django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/5b0499d9-073f-4d3e-8f38-4160e4b50f65%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bcae5cee-cc8b-4b9a-809b-37cb47d256a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Customizing serializer based on emplid

2019-03-13 Thread siddarthkatekar



my serializer looks like 
class FeeSerializer(serializers.Modelserializer):
class Meta:
model = Fee
fields = (
'id',
'name',
'emplid',
'emplid_check'
)


I want to serialize and send 'emplid_check' in the response for few 
'emplid', How to customize serializer.

1) If 'emplid' matches serializer should include 'emplid_check'
2) If not matches exclude


can someone suggest me please,


Thank you
Siddharth Kantekar







-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1bd85a12-db16-4f37-9663-ad761ca6e60b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


I need adding records within another model

2019-03-13 Thread Jack Gonzales
Hi everyone, i have two classes in my model.py, this system is for 
registering the payments of an account, for instance, a client is lent 1000 
dollars and that account has an ID, each loan has an ID and what i want is 
when the client makes the payment of his fees i can register each ammount 
and that every payment is linked with the ID of the account, 1000 dollars 
could be 10 payments of 100 dollars and that 10 records are linked to that 
account and the same for all loans, every loan with its records of payment. 
I hope that you've could understand and help me.
 

## THIS IS THE MODEL OF LOANS DATA WHERE THE DATA OF LOAN IS STORED.

class LoansData(models.Model):
"""
Profile model.

Proxy model that extend the base data
with other informarion.
"""

customer   = models.ForeignKey(CustomerData, 
on_delete=models.CASCADE)
ammount= models.PositiveIntegerField(default=0)
interest   = models.DecimalField(max_digits=3, decimal_places=2)
total  = models.PositiveIntegerField(editable=False)

uid   = models.CharField('UUID', max_length=5, help_text='5 
characters', blank=True)

created= models.DateField(auto_now_add=True)
modified   = models.DateTimeField(auto_now=True)

def save(self, *args, **kwargs):
self.total = self.ammount + (self.ammount*self.interest)
super(LoansData, self).save(*args, **kwargs)



class Meta:
verbose_name = 'Loan Data'
verbose_name_plural = 'Loans Data'

def __str__(self):
""" Return username """

return str(self.pk)   






#THIS IS WHAT I CREATED FOR ADDING THE RECORDS OF EVERY PAYMENT THE CLIENT 
MAKES TO ITS RESPECTIVE ACCOUNT OF LOAN. BUT IF IT'S NECESSARY CHANGE THIS IT 
DOESN'T MATTER.


class LoanInstance(models.Model):

"""
This represents the status up to date of loan
"""
id = models.UUIDField(primary_key=True, default=uuid.uuid4, 
help_text="Uniquie ID for every single payment." )
loan = models.ForeignKey('LoansData', on_delete=models.CASCADE, null=True)
date = models.DateField(auto_now_add=True)
ammount = models.PositiveIntegerField(default=0)

def __str__(self):
""" Return id """
return '%s' % (self.id)




###333


I REALLY HOPE THAT YOU CAN HELP ME PLEASE. I'M STUCK WITH THIS.


-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4f32f051-3770-493b-b9f5-e42843e88381%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need to Store All Model data in RAM

2019-03-13 Thread Chetan Ganji
Bhai, read your original question

*"I have a table of over 100,000 rows which I need to compare with another
list to find if the entry matching a rows is in there or not "*

Which another list were you talking about?

so the another_list could be a pre-populated list of python or another list
made of queryset.

e.g.
another_list = [1, 2, 3, 4] OR
another_list = list(Modelname.objects.all())

I hope this clears your confusion.



Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Wed, Mar 13, 2019 at 9:32 PM Vaibhav Mishra  wrote:

> Thanks Andreas, Will try out the list Method.
>
> On Wednesday, March 13, 2019 at 9:58:16 AM UTC-4, Andréas Kühne wrote:
>>
>> Hi,
>>
>> You can't. The way that you are working - it would always go back to the
>> database - because you are using the filter methods.
>>
>> You would need to create a list from the items, then do the comparison in
>> python - which probably will be slower (but not necessarily).
>>
>> Regards,
>>
>> Andréas
>>
>>
>> Den ons 13 mars 2019 kl 12:44 skrev Vaibhav Mishra :
>>
>>> Hi All,
>>>
>>> I have a table of over 100,000 rows which I need to compare with another
>>> list to find if the entry matching a rows is in there or not
>>>
>>> The following does not work
>>>
>>> getdata = data.objects.all()
>>>
>>>
>>> mydata= getdata.filter(mycriteria)
>>>
>>>
>>>
>>>
>>> Process information and comparision from 'mydata'
>>>
>>>
>>>
>>> .The code .should fetch all data and should no longer go to Database. ,
>>> but it still seem to hit database
>>> .
>>> Whenever I am running code, I see that for each comparision , the Code
>>> is Hitting the database resulting in over thousands of queries and lot of
>>> delay in finishing Processing data.
>>>
>>> How can I force All Data to be stored in RAM so that its no longer
>>> needed to access database. ?
>>>
>>> --
>>> 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 django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/a120e643-936e-4f6a-9662-7811808fa8cf%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5b0499d9-073f-4d3e-8f38-4160e4b50f65%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMKMUjv6Z-tSmmqD9CP1wGchSPvtTieqi_Ga8Yf7sSJgO-6dyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need to Store All Model data in RAM

2019-03-13 Thread Vaibhav Mishra
Thanks Andreas, Will try out the list Method.

On Wednesday, March 13, 2019 at 9:58:16 AM UTC-4, Andréas Kühne wrote:
>
> Hi,
>
> You can't. The way that you are working - it would always go back to the 
> database - because you are using the filter methods.
>
> You would need to create a list from the items, then do the comparison in 
> python - which probably will be slower (but not necessarily).
>
> Regards,
>
> Andréas
>
>
> Den ons 13 mars 2019 kl 12:44 skrev Vaibhav Mishra  >:
>
>> Hi All,
>>
>> I have a table of over 100,000 rows which I need to compare with another 
>> list to find if the entry matching a rows is in there or not 
>>
>> The following does not work
>>
>> getdata = data.objects.all()
>>
>>
>> mydata= getdata.filter(mycriteria)
>>
>>
>>
>>
>> Process information and comparision from 'mydata'
>>
>>
>>
>> .The code .should fetch all data and should no longer go to Database. , 
>> but it still seem to hit database
>> .
>> Whenever I am running code, I see that for each comparision , the Code is 
>> Hitting the database resulting in over thousands of queries and lot of 
>> delay in finishing Processing data. 
>>
>> How can I force All Data to be stored in RAM so that its no longer needed 
>> to access database. ?
>>
>> -- 
>> 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 django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/a120e643-936e-4f6a-9662-7811808fa8cf%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5b0499d9-073f-4d3e-8f38-4160e4b50f65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need to Store All Model data in RAM

2019-03-13 Thread Vaibhav Mishra
Hi Chetan,

Thanks for your help, I have a confusion , the code uses another_list as a 
list on line 1 ,and is being queried in the loop below , but where did it 
get populated ? Sorry if I sound stupid.  

On Wednesday, March 13, 2019 at 10:08:39 AM UTC-4, Chetan Ganji wrote:
>
> Hi Vaibhav, 
>
> Andréas is right. You need to evaluate the queryset first as the orm 
> queries are lazy. 
> So the solution would be something like below example. 
>
>
> another_list = [] 
> getdata = data.objects.all() # this is a queryset
>
> # apply filters if you need to
>
> getdata = list(getdata) # this would be a list in python
>
> for item in getdata: # won't hit database again
> if item in another_list:
> # do something
> pass
>
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji@gmail.com 
> http://ryucoder.in
>
>
> On Wed, Mar 13, 2019 at 7:27 PM Andréas Kühne  > wrote:
>
>> Hi,
>>
>> You can't. The way that you are working - it would always go back to the 
>> database - because you are using the filter methods.
>>
>> You would need to create a list from the items, then do the comparison in 
>> python - which probably will be slower (but not necessarily).
>>
>> Regards,
>>
>> Andréas
>>
>>
>> Den ons 13 mars 2019 kl 12:44 skrev Vaibhav Mishra > >:
>>
>>> Hi All,
>>>
>>> I have a table of over 100,000 rows which I need to compare with another 
>>> list to find if the entry matching a rows is in there or not 
>>>
>>> The following does not work
>>>
>>> getdata = data.objects.all()
>>>
>>>
>>> mydata= getdata.filter(mycriteria)
>>>
>>>
>>>
>>>
>>> Process information and comparision from 'mydata'
>>>
>>>
>>>
>>> .The code .should fetch all data and should no longer go to Database. , 
>>> but it still seem to hit database
>>> .
>>> Whenever I am running code, I see that for each comparision , the Code 
>>> is Hitting the database resulting in over thousands of queries and lot of 
>>> delay in finishing Processing data. 
>>>
>>> How can I force All Data to be stored in RAM so that its no longer 
>>> needed to access database. ?
>>>
>>> -- 
>>> 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 django-users...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com 
>>> .
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/a120e643-936e-4f6a-9662-7811808fa8cf%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> -- 
>> 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 django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAK4qSCevkAVGFf%3DMrS8VVsv2BgPuDkRUqW_tSFwk1dfrzb7pvg%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a8889450-8e77-4e82-9d95-b998ebae70d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: migrating from sqlite to mysql breaks the site

2019-03-13 Thread Anh Nguyen
Could you insert a post on admin panel ?

On Wed, Mar 13, 2019 at 10:38 PM Pedram Badakhchani <
pedrambadakhch...@gmail.com> wrote:

> bump
>
> On Wednesday, 6 March 2019 10:44:56 UTC, Pedram Badakhchani wrote:
>>
>> specifically in the get_absolute_url method.
>>>
>>
>> I don't understand why this works fine with sqlite but breaks in mysql.
>>
>> thanks for any help.
>>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4db98bc9-72f6-4914-8d48-7ae60308a14e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKaoNbS1zNcEf1U0E1hp%2BWfeh8-kNZ3NPQ5z97mVCs5sDrOesA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: migrating from sqlite to mysql breaks the site

2019-03-13 Thread Pedram Badakhchani
bump

On Wednesday, 6 March 2019 10:44:56 UTC, Pedram Badakhchani wrote:
>
> specifically in the get_absolute_url method.
>>
>
> I don't understand why this works fine with sqlite but breaks in mysql.
>
> thanks for any help. 
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4db98bc9-72f6-4914-8d48-7ae60308a14e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ML-Python

2019-03-13 Thread Utpal Mishra
You have to use "model_selection", it will work. Quite a while ago
"cross_validation" has been replaced by" model_selection".
For reference you can go through my code:
https://colab.research.google.com/drive/1NliqtxZVvLhZNXhNFyXQZpwG392hcvh4
Do inform, in any case.

On Wed, Mar 13, 2019 at 5:14 PM Hafit Omar  wrote:

> Hi Everyone I'm Hafit from Libya,
> Can anyone help me in in sklearn library I want to import cross_validation
> it doesn't work but the other like preprocessing and svm it does, please
> it's urgent,
> Thank you in advance
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP%3DccR57ZTOvdw8EUSozSOGvK2%2BzZJb6q3ocoAA%2B9Rk4FJjTbA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAObFs%3DeC593qwhgFx30g6uqsyenhoq5Sru6F7SA0%3DLQY5pinXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using sessions key variables as a url argument

2019-03-13 Thread GavinB841
Hi Alvaro/Ranganath,

Appreciate your feedback, I understand what you are recommending but I can 
seem to get it working. 

Please see the below hopefully it will make more sense:

*View sample for team:*

class TeamInfo(APIView):
renderer_classes = [TemplateHTMLRenderer]
template_name = 'teams.html'

def get(self, request):
club_pk = request.session.get('pk')
form = TeamForm()
teams = Team.objects.filter(club_id=club_pk)
return Response({'form': form,
 'teams': teams,
 'club_pk': club_pk
 })


*Urls: *

urlpatterns = [
path('', views.club_home, name='club_home'),
path('/', views.club_home, name='club_home_with_pk'),
path('/teams/', views.TeamInfo.as_view(), name='teams'),
]


*In my nav bar in the template: *

Team


How can I pass that session key argument into this template? 

Thanks 

Gavin 


On Sunday, 10 March 2019 14:57:43 UTC, GavinB841 wrote:
>
> Hi all, 
>
> I am not sure if this is possible as I could find nothing online but would 
> appreciate any alternative solution.
>
>- In my view I obtain a pk which is set as a session key 
>- I need to pass that session key variable into the url argument.
>
> e.g. http://127.0.0.1:8000/club_home//teams/
>
> Code below, any other samples of code needed let me know
>
> Thanks
> Gav
>
> *Main Urls*
>
> urlpatterns = [
> url('admin/', admin.site.urls),
> url(r'^club_home/', include('clubkit.clubs.urls'), name='clubs'),
> ]
>
> *Urls.py*
>
> urlpatterns = [
> path('', views.club_home, name='club_home'),
> path('teams/', views.TeamInfo.as_view(), name='teams'),
> path('pitches/', views.PitchInfo.as_view(), name='pitches'),
> ]
>
> *View.py:*
>
> def club_home(request, pk=None):
> if pk:
> request.session['pk'] = pk
> club = ClubInfo.objects.filter(pk=pk)
> club_posts = ClubPosts.objects.filter(club_id=club[0])
> else:
> club_pk = request.session.get('pk')
> club = ClubInfo.objects.filter(pk=club_pk)
> club_posts = ClubPosts.objects.filter(club_id=club[0])
> args = {'club': club,
> 'club_posts': club_posts
> }
> return render(request, 'club_home_page.html', args)
>
>
> *Séanadh Ríomhphoist/Email DisclaimerTá an ríomhphost seo agus aon chomhad 
> a sheoltar leis faoi rún agus is lena úsáid ag an seolaí agus sin amháin 
> é. Is féidir tuilleadh a léamh anseo. 
>   
> This e-mail and any 
> files transmitted with it are confidential and are intended solely for use 
> by the addressee. Read more here. 
>  *
>
>
-- 
__

Séanadh Ríomhphoist/_

Email Disclaimer__
**

Tá an ríomhphost seo agus 
aon chomhad a sheoltar leis faoi rún agus is lena úsáid ag an seolaí agus 
sin amháin é. Is féidir tuilleadh a léamh anseo. 
  
*
_

This e-mail and any 
files transmitted with it are confidential and are intended solely for use 
by the addressee. Read more here. 
 _
*_

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7c47d2e6-d1be-49f4-84c2-a12536164105%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ML-Python

2019-03-13 Thread Hafit Omar
When I type from sklearn import cross_validation , appears red line on
cross_validation what's wrong?

On Wed, 13 Mar 2019, 10:10 pm Bob Gailer,  wrote:

> On Mar 13, 2019 7:44 AM, "Hafit Omar"  wrote:
> >
> > Hi Everyone I'm Hafit from Libya,
> > Can anyone help me in in sklearn library I want to import
> cross_validation it doesn't work
>
> Please be more specific. What is the evidence that it doesn't work?
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP1rxO7yws2wsRK6Zs32XCe9SU-j-zgFLNogX_jZWb3W_QCkFg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%3DccR7LbL%3D3RuVFhRTCEkzQWmG4uM8q5uCXSpAqD3--E5cVNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ML-Python

2019-03-13 Thread Bob Gailer
On Mar 13, 2019 7:44 AM, "Hafit Omar"  wrote:
>
> Hi Everyone I'm Hafit from Libya,
> Can anyone help me in in sklearn library I want to import
cross_validation it doesn't work

Please be more specific. What is the evidence that it doesn't work?

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP1rxO7yws2wsRK6Zs32XCe9SU-j-zgFLNogX_jZWb3W_QCkFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need to Store All Model data in RAM

2019-03-13 Thread Chetan Ganji
Hi Vaibhav,

Andréas is right. You need to evaluate the queryset first as the orm
queries are lazy.
So the solution would be something like below example.


another_list = []
getdata = data.objects.all() # this is a queryset

# apply filters if you need to

getdata = list(getdata) # this would be a list in python

for item in getdata: # won't hit database again
if item in another_list:
# do something
pass



Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Wed, Mar 13, 2019 at 7:27 PM Andréas Kühne 
wrote:

> Hi,
>
> You can't. The way that you are working - it would always go back to the
> database - because you are using the filter methods.
>
> You would need to create a list from the items, then do the comparison in
> python - which probably will be slower (but not necessarily).
>
> Regards,
>
> Andréas
>
>
> Den ons 13 mars 2019 kl 12:44 skrev Vaibhav Mishra :
>
>> Hi All,
>>
>> I have a table of over 100,000 rows which I need to compare with another
>> list to find if the entry matching a rows is in there or not
>>
>> The following does not work
>>
>> getdata = data.objects.all()
>>
>>
>> mydata= getdata.filter(mycriteria)
>>
>>
>>
>>
>> Process information and comparision from 'mydata'
>>
>>
>>
>> .The code .should fetch all data and should no longer go to Database. ,
>> but it still seem to hit database
>> .
>> Whenever I am running code, I see that for each comparision , the Code is
>> Hitting the database resulting in over thousands of queries and lot of
>> delay in finishing Processing data.
>>
>> How can I force All Data to be stored in RAM so that its no longer needed
>> to access database. ?
>>
>> --
>> 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 django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a120e643-936e-4f6a-9662-7811808fa8cf%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAK4qSCevkAVGFf%3DMrS8VVsv2BgPuDkRUqW_tSFwk1dfrzb7pvg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMKMUjs%3DxtJPN-gmnfmg7M%3DSGsP0jg5qru6o%3DcQGJmuqabckkA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need to Store All Model data in RAM

2019-03-13 Thread Andréas Kühne
Hi,

You can't. The way that you are working - it would always go back to the
database - because you are using the filter methods.

You would need to create a list from the items, then do the comparison in
python - which probably will be slower (but not necessarily).

Regards,

Andréas


Den ons 13 mars 2019 kl 12:44 skrev Vaibhav Mishra :

> Hi All,
>
> I have a table of over 100,000 rows which I need to compare with another
> list to find if the entry matching a rows is in there or not
>
> The following does not work
>
> getdata = data.objects.all()
>
>
> mydata= getdata.filter(mycriteria)
>
>
>
>
> Process information and comparision from 'mydata'
>
>
>
> .The code .should fetch all data and should no longer go to Database. ,
> but it still seem to hit database
> .
> Whenever I am running code, I see that for each comparision , the Code is
> Hitting the database resulting in over thousands of queries and lot of
> delay in finishing Processing data.
>
> How can I force All Data to be stored in RAM so that its no longer needed
> to access database. ?
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a120e643-936e-4f6a-9662-7811808fa8cf%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCevkAVGFf%3DMrS8VVsv2BgPuDkRUqW_tSFwk1dfrzb7pvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: add Image Field in model

2019-03-13 Thread omar ahmed
i installed it 
thanks Amitesh
but what about creating image field in model

On Wednesday, March 13, 2019 at 10:58:50 AM UTC+2, Amitesh Sahay wrote:
>
> Hello Omar, 
>
> You need to install "pillow" python module in order to work with image 
> files.
>
> Regards,
> Amitesh Sahay
> *91-750 797 8619*
>
>
> On Tuesday, 12 March, 2019, 6:51:09 pm IST, omar ahmed  > wrote: 
>
>
> hello
> i want to add image field in my model
> i typed :
>  image = models.ImageField()
> but :
>  Cannot use ImageField because Pillow is not installed
>
> -- 
> 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 django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/6101b636-925a-4f22-9637-13678d2ecaf0%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/905656a7-ae5c-406e-967a-1183ad23e728%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Queryset for Multiple set

2019-03-13 Thread Chetan Ganji
Hi Vaibhav,

I think this would do what you want. Make sure too call the objects on the
model name (  Modelname  ) ;-)


systems = ['windows', 'unix']
variable = Modelname.objects.filter(clientname=cname, clienttype__in=systems,
errorcode='20')



Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Wed, Mar 13, 2019 at 5:17 PM Krishnasagar Subhedarpage <
pagesa...@gmail.com> wrote:

> You could do using django ORM query expressions. Refer below link:
> https://docs.djangoproject.com/en/2.1/ref/models/expressions/
>
>
> Regards,
> Krishnasagar Subhedarpage
>
>
>
> On Wed, 13 Mar 2019 at 17:14, Vaibhav Mishra  wrote:
>
>> Hi All,
>>
>> I am trying to achieve below ,
>>
>> variable = object.filter(clientname =cname , clienttype='windows' and
>> clienttype='unix', errorcode='20')
>>
>>
>>
>>  Notice that I want to filter by two or more values in second parameter..
>> How can we do this ?
>>
>> --
>> 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 django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/54464687-7fd0-4103-b74f-5de566ae9e89%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAChYJc8NwTG5LDBmjBbFav3b125dOsNCTwtHN%3DJrMbhrZ9T0rw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMKMUjt2mw0mfbHHqD2p7_PPD2%3DGFgJM0QadR%3Di_bb5HpG7ORA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django csv file

2019-03-13 Thread Chetan Ganji
Welcme CIGI

Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Wed, Mar 13, 2019 at 5:13 PM Cigi Sebastine 
wrote:

> Thank you Chetan.
>
>
> On Wed, Mar 13, 2019 at 3:41 AM Chetan Ganji 
> wrote:
>
>> I would suggest you use transactions for inserting those many documents.
>> https://www.mongodb.com/transactions
>>
>> Django ORM does not support MongoDB. So, you can't use models/ORM/Class
>> Based Views of Django with mongo.
>> Only way I know to use Mongo with Django is function based views. There
>> are some third party MONGO ORMS for django, but I never used them so far,
>> so can't comment on how good they are or are not. Do your R&D and find it
>> out ;-)
>>
>> I hope this helps you. Cheers!
>>
>>
>> Regards,
>> Chetan Ganji
>> +91-900-483-4183
>> ganji.che...@gmail.com
>> http://ryucoder.in
>>
>>
>> On Wed, Mar 13, 2019 at 12:42 AM Ryan Nowakowski 
>> wrote:
>>
>>> If I were you, I'd work through the Django tutorial first. Then ask
>>> specific questions if you have any.
>>>
>>> On March 12, 2019 5:32:08 AM CDT, Cigi Sebastine <
>>> cigisebast...@gmail.com> wrote:


 Hi all

 I am trying to insert data from csv file to mongodb4 using python3.7
 (Bulk data insertion 47lakhs records)
 i need to implement in django
 Can please anyone share ur idea

 import pandas as pd
 import json

 mng_client = MongoClient('localhost', 27017)
 mng_db = mng_client['testcsv']
 collection_name = mng_db['datastore']
 db_cm = mng_db['datastore']

 df = pd.read_csv('filepath',encoding = 'ISO-8859-1') # loading csv file
 #dfstr = df.to_json('testjson1.json')
 data_json = json.loads( df.to_json())
 db_cm.insert_many(data_json)

 --
>>> 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 django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/89E98305-6AEC-4A82-9839-E86760DC3AB2%40fattuba.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMKMUjv%3DrU%3DNJxhd%2BHwpz40RrFB_Z2qP9Mq7q2SoXFys4HSO2Q%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAaRqFM-NALvhVJgcDXvRZoa7M-cgSURTbPMAQRcSUVxtH8THw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMKMUjsNd0BVch1zpjDU859DoGWiFTOGZ17e873C_vNwD9SfiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Queryset for Multiple set

2019-03-13 Thread Krishnasagar Subhedarpage
You could do using django ORM query expressions. Refer below link:
https://docs.djangoproject.com/en/2.1/ref/models/expressions/


Regards,
Krishnasagar Subhedarpage



On Wed, 13 Mar 2019 at 17:14, Vaibhav Mishra  wrote:

> Hi All,
>
> I am trying to achieve below ,
>
> variable = object.filter(clientname =cname , clienttype='windows' and
> clienttype='unix', errorcode='20')
>
>
>
>  Notice that I want to filter by two or more values in second parameter..
> How can we do this ?
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/54464687-7fd0-4103-b74f-5de566ae9e89%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAChYJc8NwTG5LDBmjBbFav3b125dOsNCTwtHN%3DJrMbhrZ9T0rw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Hello From Nigeria

2019-03-13 Thread Thaddeaus Iorbee
Yes please.  0814390

On Monday, March 11, 2019, Joshua Kayode  wrote:

> Greetings, if you are a django developer in Nigeria, would you consider
> joining a WhatsApp group?
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAEL9fCFn_XXW26_wXAz0K%3DaHTA31mhWMhhCQcxvpMSn1ZMSuEg
> %40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJ0TiMfnATkaWkfOR0T0ge3RyXzCmPM4QzWLdy%2BkyBdQGDiKTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django csv file

2019-03-13 Thread Cigi Sebastine
Thank you Chetan.


On Wed, Mar 13, 2019 at 3:41 AM Chetan Ganji  wrote:

> I would suggest you use transactions for inserting those many documents.
> https://www.mongodb.com/transactions
>
> Django ORM does not support MongoDB. So, you can't use models/ORM/Class
> Based Views of Django with mongo.
> Only way I know to use Mongo with Django is function based views. There
> are some third party MONGO ORMS for django, but I never used them so far,
> so can't comment on how good they are or are not. Do your R&D and find it
> out ;-)
>
> I hope this helps you. Cheers!
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
> On Wed, Mar 13, 2019 at 12:42 AM Ryan Nowakowski 
> wrote:
>
>> If I were you, I'd work through the Django tutorial first. Then ask
>> specific questions if you have any.
>>
>> On March 12, 2019 5:32:08 AM CDT, Cigi Sebastine 
>> wrote:
>>>
>>>
>>> Hi all
>>>
>>> I am trying to insert data from csv file to mongodb4 using python3.7
>>> (Bulk data insertion 47lakhs records)
>>> i need to implement in django
>>> Can please anyone share ur idea
>>>
>>> import pandas as pd
>>> import json
>>>
>>> mng_client = MongoClient('localhost', 27017)
>>> mng_db = mng_client['testcsv']
>>> collection_name = mng_db['datastore']
>>> db_cm = mng_db['datastore']
>>>
>>> df = pd.read_csv('filepath',encoding = 'ISO-8859-1') # loading csv file
>>> #dfstr = df.to_json('testjson1.json')
>>> data_json = json.loads( df.to_json())
>>> db_cm.insert_many(data_json)
>>>
>>> --
>> 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 django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/89E98305-6AEC-4A82-9839-E86760DC3AB2%40fattuba.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMKMUjv%3DrU%3DNJxhd%2BHwpz40RrFB_Z2qP9Mq7q2SoXFys4HSO2Q%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAaRqFM-NALvhVJgcDXvRZoa7M-cgSURTbPMAQRcSUVxtH8THw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Need to Store All Model data in RAM

2019-03-13 Thread Vaibhav Mishra
Hi All,

I have a table of over 100,000 rows which I need to compare with another 
list to find if the entry matching a rows is in there or not 

The following does not work

getdata = data.objects.all()


mydata= getdata.filter(mycriteria)




Process information and comparision from 'mydata'



.The code .should fetch all data and should no longer go to Database. , but 
it still seem to hit database
.
Whenever I am running code, I see that for each comparision , the Code is 
Hitting the database resulting in over thousands of queries and lot of 
delay in finishing Processing data. 

How can I force All Data to be stored in RAM so that its no longer needed 
to access database. ?

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a120e643-936e-4f6a-9662-7811808fa8cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Queryset for Multiple set

2019-03-13 Thread Vaibhav Mishra
Hi All,

I am trying to achieve below ,

variable = object.filter(clientname =cname , clienttype='windows' and 
clienttype='unix', errorcode='20')



 Notice that I want to filter by two or more values in second parameter.. 
How can we do this ?

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54464687-7fd0-4103-b74f-5de566ae9e89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Ldap authentication and Token generation

2019-03-13 Thread Dimple Mathew
I am developing a django project. I want to implement SSO in it. The 
authentication is done by LDAP
So should the apps generate tokens[with same algo and secret keys] and then 
send the token along with the request?
How should I go about implementing this?

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/12beeac2-3f1f-4982-9b65-29f370d4b18c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ML-Python

2019-03-13 Thread Hafit Omar
Hi Everyone I'm Hafit from Libya,
Can anyone help me in in sklearn library I want to import cross_validation
it doesn't work but the other like preprocessing and svm it does, please
it's urgent,
Thank you in advance

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%3DccR57ZTOvdw8EUSozSOGvK2%2BzZJb6q3ocoAA%2B9Rk4FJjTbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: hi guys i have been having trouble setting up a login and registration page, can anyone please help me

2019-03-13 Thread gauravsrivastava2k17
Please post traceback so that I can know what type of error you are getting


On Tuesday, March 12, 2019 at 8:26:04 PM UTC+5:30, abhishek jayalal wrote:
>
>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b50f57f4-d2bf-42ae-a809-8b929ffe5211%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: add Image Field in model

2019-03-13 Thread 'Amitesh Sahay' via Django users
Hello Omar, 
You need to install "pillow" python module in order to work with image files.


Regards,
Amitesh Sahay91-750 797 8619 

On Tuesday, 12 March, 2019, 6:51:09 pm IST, omar ahmed 
 wrote:  
 
 helloi want to add image field in my modeli typed :
 image = models.ImageField()but :
 Cannot use ImageField because Pillow is not installed


-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6101b636-925a-4f22-9637-13678d2ecaf0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1238457488.3929863.1552467468790%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.


Re: Zero Downtime Field Type Changes

2019-03-13 Thread Markus Holtermann
Hey Kyle, that sounds about right. It's a variation of the "Migration Recipe" I 
came up with a while ago: 
https://markusholtermann.eu/2016/04/django-migrations-recipe-2/ . My question 
would be if you really need the field of the new type to have the exact same 
name as the old one. If you can live or deal with the new type using a 
different name it's much easier as you don't need to migrate data twice.

/Markus

On Wed, Mar 13, 2019, at 4:41 AM, 'Kyle Mulka' via Django users wrote:
> Hi there,
> 
> Wondering if there's any tool out there to make a zero downtime field 
> type change easier. I want to change a django model field from one type 
> to another, and the format of the field in the database is slightly 
> different.
> 
> I've come up with a process I think will work, but it will be rather 
> tedious if done manually. Wondering if there's a more automated 
> approach or other tools out there already. I'd like to come up with a 
> general solution for use in the future, but right now trying to tackle 
> converting UUIDField from django-extensions to the built in django 
> version.
> https://github.com/django-extensions/django-extensions/issues/647
> 
> I was thinking about maybe using a custom field that supports both 
> types, but not exactly sure how to write a custom field that would do 
> that.
> 
> If it helps, the manual process I'm thinking about kind of goes as follows:
> 
> # existing model:
> class Model:
> field = OldField()
> 
> # add field_old with OldField type
> # when updating or adding rows start writing to both fields
> # copy data from field to field_old
> class Model:
> field = OldField()
> field_old = OldField()
> 
> # stop using field, only use field_old
> # remove field
> class Model:
> field_old = OldField()
> 
> # create field with new type
> # when updating or adding rows start writing to both fields in their 
> respective formats
> # copy data from field_old in old format to field in new format
> class Model:
> field = NewField()
> field_old = OldField()
> 
> # stop using field_old
> # remove field_old
> class Model:
> field = NewField()
> 
> Thanks for your help!
> 
> --
> Kyle Mulka
> http://www.kylemulka.com
> 
>  -- 
>  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 django-users+unsubscr...@googlegroups.com.
>  To post to this group, send email to django-users@googlegroups.com.
>  Visit this group at https://groups.google.com/group/django-users.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/b16ffdee-74d6-4ba2-ac1f-b5bd9cf1e40b%40googlegroups.com
>  
> .
>  For more options, visit https://groups.google.com/d/optout.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d75dee2f-d273-4d47-9d3f-859aac0e6d96%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.