Re: Website slowed down drasticaly

2019-05-06 Thread Saurabh Adhikary
Hey Sally,Alex,Scott,

I'm real glad to see that , all of you are exactly pointing out the area of 
my concern. Thank you so much.

The point is , there are no major change that was deployed on to the code 
since Dec'18. 
As I did mention that there has been some minor load increase of our users 
in the new year since Jan, but the change is not significant.
(Originally we had around 2million unique people , ~5million approx approx 
users in total, and around 50K new users during this time)
We are on MySQL 14.14  Distrib 5.1.73. My worry is if *Django support(for 
1.8.1)* or *Python support (for 2.7.12*) diminishing is the *main reason 
for slowing down.*
Rest, the debugging has been done, wherin we could'nt find a fault as of 
yet.

My project is really big and I hence wish to seek some experience or 
concrete knowledge before investing time for upgrading Django & Python.

Regards,
Saurabh

On Sunday, 5 May 2019 19:36:25 UTC+5:30, Sally Middleton wrote:
>
> Hi
>
> From a generic debugging point of view, you need to find out the root 
> cause of the performance decline. Ideally you need to isolate and test each 
> part of the system in turn and look for the one which is causing the 
> problem. 
>
> 1. If it can be reproduced on a prod-like environment then that's really 
> great as you can make changes easily to test. Always keep a note of EXACTLY 
> what you've changed and put it back the way it was previously before your 
> next test. If you cannot reproduce that also tells you something, for 
> example it's due to data quantities or prod-hardware.
>
> 2. Put tracing/logging on your prod environment database and check for SQL 
> for degradation (maybe compared to your development env). Maybe all is OK 
> or one query is slow or everything is slow. Any performance issues will 
> need tuning, but it sounds like you are looking for something quite 
> fundamental.
>
> 3. What happened in February? Did you perform a release to Production? 
> What was in it? If you roll-back (in test environment) does it fix the 
> problem? Maybe it is a component that has been updated. Any configuration 
> changes to your web server?
>
> 4. If it isn't the database then it's something else. You need to isolate 
> each part of the system in turn and put on logging then check the results.
>
> Best regards
> Sally
>
>
> On Thursday, 2 May 2019 12:40:20 UTC+1, Saurabh Adhikary wrote:
>>
>> Hello , 
>>
>> I'm using Django version 1.8.1  and Python version 2.7.12 . Suddenly 
>> since Feb '19 there has been a drastic decrease in my website's response 
>> rate.
>> For sure , there has been some minor increase in the no of hits, but the 
>> performance is too bad.
>>
>> Initially , the thought came that the hardware of the server was old , so 
>> a new server with high configuration was bought.
>> We have done the new indexing also on it.
>> Still the sought for a higher performance is awaited.
>>
>>
>> Is it that the Django support for 1.8.1 or Python support for 2.7.12 has 
>> reduced and that is casing the website to slow down or I am missing out on 
>> something ?
>> Kindly 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/85afc1b7-f8bb-468d-8759-c41bf3645dce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Website slowed down drasticaly

2019-05-06 Thread Nick Sarbicki
Hi Saurabh,

If the diminishing support was a cause of the dramatic slowdown then this
would have had to be intentionally put into the codebase. I'm almost
certain this isn't the case.

All losing support really means is that the developers no longer provide
updates and security patches. There would not be a slowdown as nothing
actually changes in your dependencies.

Sorry to say that it's almost certainly caused by a change in your code,
configuration, state, or limited by your hardware.


On Mon, 6 May 2019, 08:21 Saurabh Adhikary, 
wrote:

> Hey Sally,Alex,Scott,
>
> I'm real glad to see that , all of you are exactly pointing out the area
> of my concern. Thank you so much.
>
> The point is , there are no major change that was deployed on to the code
> since Dec'18.
> As I did mention that there has been some minor load increase of our users
> in the new year since Jan, but the change is not significant.
> (Originally we had around 2million unique people , ~5million approx approx
> users in total, and around 50K new users during this time)
> We are on MySQL 14.14  Distrib 5.1.73. My worry is if *Django support(for
> 1.8.1)* or *Python support (for 2.7.12*) diminishing is the *main reason
> for slowing down.*
> Rest, the debugging has been done, wherin we could'nt find a fault as of
> yet.
>
> My project is really big and I hence wish to seek some experience or
> concrete knowledge before investing time for upgrading Django & Python.
>
> Regards,
> Saurabh
>
> On Sunday, 5 May 2019 19:36:25 UTC+5:30, Sally Middleton wrote:
>>
>> Hi
>>
>> From a generic debugging point of view, you need to find out the root
>> cause of the performance decline. Ideally you need to isolate and test each
>> part of the system in turn and look for the one which is causing the
>> problem.
>>
>> 1. If it can be reproduced on a prod-like environment then that's really
>> great as you can make changes easily to test. Always keep a note of EXACTLY
>> what you've changed and put it back the way it was previously before your
>> next test. If you cannot reproduce that also tells you something, for
>> example it's due to data quantities or prod-hardware.
>>
>> 2. Put tracing/logging on your prod environment database and check for
>> SQL for degradation (maybe compared to your development env). Maybe all is
>> OK or one query is slow or everything is slow. Any performance issues will
>> need tuning, but it sounds like you are looking for something quite
>> fundamental.
>>
>> 3. What happened in February? Did you perform a release to Production?
>> What was in it? If you roll-back (in test environment) does it fix the
>> problem? Maybe it is a component that has been updated. Any configuration
>> changes to your web server?
>>
>> 4. If it isn't the database then it's something else. You need to isolate
>> each part of the system in turn and put on logging then check the results.
>>
>> Best regards
>> Sally
>>
>>
>> On Thursday, 2 May 2019 12:40:20 UTC+1, Saurabh Adhikary wrote:
>>>
>>> Hello ,
>>>
>>> I'm using Django version 1.8.1  and Python version 2.7.12 . Suddenly
>>> since Feb '19 there has been a drastic decrease in my website's response
>>> rate.
>>> For sure , there has been some minor increase in the no of hits, but the
>>> performance is too bad.
>>>
>>> Initially , the thought came that the hardware of the server was old ,
>>> so a new server with high configuration was bought.
>>> We have done the new indexing also on it.
>>> Still the sought for a higher performance is awaited.
>>>
>>>
>>> Is it that the Django support for 1.8.1 or Python support for 2.7.12 has
>>> reduced and that is casing the website to slow down or I am missing out on
>>> something ?
>>> Kindly 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/85afc1b7-f8bb-468d-8759-c41bf3645dce%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/CAGuvt91SYm4vNjZ-bswbCOPSPazECtqv5YX0oRXgqE%3DWPJqHAA%40mail.gmail.com.
For more options

Re: Website slowed down drasticaly

2019-05-06 Thread Tim Chase
On 2019-05-06 00:20, Saurabh Adhikary wrote:
> The point is , there are no major change that was deployed on to
> the code since Dec'18. 
> As I did mention that there has been some minor load increase of
> our users in the new year since Jan, but the change is not
> significant. (Originally we had around 2million unique people ,
> ~5million approx approx users in total, and around 50K new users
> during this time)

I imagine that, if nothing changed in the code, and nothing changed
in the back-end server infrastructure (no changes to your DB
settings, server hardware, etc), but there was an increase in
traffic, then I imagine the issue stems from some unfortunate scaling
issues.  Often this is either related to poor choices for indexing in
the database or some algorithm that used to work fine with smaller
datasets but fails to scale to larger numbers of users.

-tim



-- 
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/20190506054858.57754fa2%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


Re: How to design database for django rest api

2019-05-06 Thread salimon jamiu olashile
Hello,

You can use Django REST Framework to create Django APIs. Check out this
tutorial (part 1 & 2) by King Kasulani on Medium. You can check Django REST
Framework official website also.

https://medium.com/backticks-tildes/lets-build-an-api-with-django-rest-framework-32fcf40231e5

https://medium.com/backticks-tildes/lets-build-an-api-with-django-rest-framework-part-2-cfb87e2c8a6c

Note: There are other libraries you can use to create a Django API such as
tastypie

I hope this helps.
 Regards.

On Mon, 6 May 2019 at 6:35 AM, RONAK JAIN  wrote:

> Hello,
>
>
> I am trying to start a new website in Django so the whole website my task
> is here make Django rest API. I have an angular template which is related
> to education + eCommerce there.
> So, I am not getting here how can I start to make Django rest API and what
> is my first step?  because of mostly part there in the angular template.
>
> Note: I tried to concentrate make design database but, I am not getting
> where and what can I start here database design because there only I was
> looking at my task form registration.
>
> please give me initial steps.
>
>
> Thanks and Regards
> Django_User
>
>
>
>
>
> --
> 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/CA%2BAqMUdKxjw0mibW%3DWnwQf_bXAraxgOvTrtiViPciq_KsFsAvw%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/CAFhdOCNU_Zvz%3DCteGTytV8eaqJrQYxco-RWK6hZXTF_mV%2B1BEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django models

2019-05-06 Thread Soumen Khatua
Hi Folks,

How this underline code works?


models.py

class Address(models.Model):
first_name = models.CharField(max_length=256, blank=True)
last_name = models.CharField(max_length=256, blank=True)
company_name = models.CharField(max_length=256, blank=True)
street_address_1 = models.CharField(max_length=256, blank=True)
street_address_2 = models.CharField(max_length=256, blank=True)
city = models.CharField(max_length=256, blank=True)
city_area = models.CharField(max_length=128, blank=True)
postal_code = models.CharField(max_length=20, blank=True)
country = CountryField()
country_area = models.CharField(max_length=128, blank=True)
phone = PossiblePhoneNumberField(blank=True, default='')


*def __eq__(self, other):*
*   return self.as_data() == other.as_data()*
* __hash__ = models.Model.__hash__*


Thank you.

-- 
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/CAPUw6WY-pNGnPBHzDA%3DiRZUHY7NrmK30_dMbKiQpe%2B1n%2ByW%2BQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Info

2019-05-06 Thread Soumen Khatua
Hi Folks,

Should I need to pay for asking questions or problem in this group?


Thank You

-- 
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/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Help Me !) How to extract name attribute of element from instantiated form object inside views.py

2019-05-06 Thread Mayur Bagul
Hello Community,

I've been stuck to this problem from one week. I have read Django Doc. and 
i found little bit relevant to my problem.

*Form.py* 


from django import forms

class NameForm(forms.Form):
city_name = forms.CharField(label='city name', max_length=100)
 


*Views.py*



from django.http import HttpResponseRedirect
from django.shortcuts import render

from .forms import NameForm

def get_name(request):
  
if request.method == 'POST':

form = NameForm(request.POST)
  
 * # Here i wanted to extract value stored inside Text Box*  *How i can 
do that?*

 *#i wanted to extract city entered by user and store into another 
variable how to do it?*

 *# i wanted to use that variable to put it for filter *


   info = Data.objects.filter(city__exact=*'city'*) 
   
   above line is for retrieving  record for entered city 
from database.


   return render(request, 'name.html', {'info': info}) 

else:
form = NameForm()

return render(request, 'name.html', {'form': form})




*Please help me with this guys !*

*i really need help on this because im not getting syntax for this on any 
resource.*

*Thanking you.*

-- 
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/666102fa-661e-4330-97f1-1414d7b08bce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: (Help Me !) How to extract name attribute of element from instantiated form object inside views.py

2019-05-06 Thread salimon jamiu olashile
use this to access the city_name field value;

form.cleaned_data[“city_name”]

Use to a print statement to see for yourself.

On Mon, 6 May 2019 at 1:42 PM, Mayur Bagul  wrote:

> Hello Community,
>
> I've been stuck to this problem from one week. I have read Django Doc. and
> i found little bit relevant to my problem.
>
> *Form.py*
>
>
> from django import forms
>
> class NameForm(forms.Form):
> city_name = forms.CharField(label='city name', max_length=100)
>
>
>
> *Views.py*
>
>
>
> from django.http import HttpResponseRedirect
> from django.shortcuts import render
>
> from .forms import NameForm
>
> def get_name(request):
>
> if request.method == 'POST':
>
> form = NameForm(request.POST)
>
>  * # Here i wanted to extract value stored inside Text Box*  *How i
> can do that?*
>
>  *#i wanted to extract city entered by user and store into another
> variable how to do it?*
>
>  *# i wanted to use that variable to put it for filter *
>
>
>info = Data.objects.filter(city__exact=*'city'*)
>
>above line is for retrieving  record for entered city
> from database.
>
>
>return render(request, 'name.html', {'info': info})
>
> else:
> form = NameForm()
>
> return render(request, 'name.html', {'form': form})
>
>
>
>
> *Please help me with this guys !*
>
> *i really need help on this because im not getting syntax for this on any
> resource.*
>
> *Thanking you.*
>
> --
> 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/666102fa-661e-4330-97f1-1414d7b08bce%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/CAFhdOCPV-ac2FEJJhtUvvK_rqYgZJ7qAt9zb-4qXyxpGMGPBxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-06 Thread Gurmeet Kaur
Hi Mayur,

For your question - I would suggest you to create a situation like how will
you call a function from views.py using ajax from a js file for the same
page?

And then you will understand the need of ajax and then will understand how
you can get the data from views.py function in a js function.

Hope this helps and if you need some more info from my end, let me know.



thanks,
Gurmeet Kaur

On Sun, May 5, 2019 at 1:59 AM Mayur Bagul  wrote:

> hi john,
>
> thanks for help.
> i new to django so i dont know how its work and how its syntax  is. until
> i found resource and learn it.
> im not getting your solution but i will search and try to learn it.
>
> thanking you.
>
>
> On Fri, May 3, 2019 at 9:05 PM John Bagiliko <
> john.bagil...@aims-senegal.org> wrote:
>
>> import serializers from django.core
>> You can simply use the serializers.serialize method to do this. No need
>> to use Restframework.
>>
>> On Fri, May 3, 2019, 3:25 PM John Bagiliko <
>> john.bagil...@aims-senegal.org> wrote:
>>
>>> Dump this result into json and render it on a page. Use AJAX to get this
>>> json data in JavaScript.
>>>
>>> On Fri, May 3, 2019, 2:41 PM sachinbg sachin 
>>> wrote:
>>>
 If u want to use that context in html means for I context ,I.user
 name,i.products like that u can use

 On Fri, May 3, 2019, 8:09 PM sachinbg sachin >>> wrote:

> In JavaScript I don't know buddy
>
> On Fri, May 3, 2019, 6:33 PM Ravi Kumar 
>> Try to use ajax
>>
>> On Fri 3 May, 2019 5:42 pm Mayur Bagul >
>>> Hello community,
>>>
>>> I have stored single value from database inside a variable which is
>>> playing role of context inside views.py function.
>>>
>>> Now I want to use this context(which holds single value) in
>>> JavaScript to change specific HTML content of template which will give 
>>> me
>>> desired webpage.
>>>
>>> I Searched on Google but I didn't found any useful tutorial or
>>> solution on specified problem.
>>>
>>> I'm looking forward to get solution from community.
>>>
>>> Thanking you.
>>>
>>> --
>>> 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/37395263-cf1d-4a7d-ad51-911e68da810b%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/CAANT8EFTTjuSXF5U87jX_VDwu6yMZpHN3GcbJ-7zBpTU5YPm2g%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/CAOs61rwmtrTfUFJFnsq2j5THzy34_x3%3DK_LmX3d51MH_NCmxFA%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/CAC26BE2Qm%2BGPqK0rf%2BMq%3Du7WFua0fLZstfoU89FnLKVY3YjXOQ%40mail.gmail.com
>> 

django project

2019-05-06 Thread randmwheeler
I am looking for 2 people to work with me on a django project.

if you are interested, email me.

randmwhee...@gmail.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/a86f0b6a-069b-49ec-98d1-7a9e74efbb24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django project

2019-05-06 Thread fazal rehman
Is it for beginners ?

On Mon 6 May, 2019, 8:01 PM ,  wrote:

> I am looking for 2 people to work with me on a django project.
>
> if you are interested, email me.
>
> randmwhee...@gmail.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/a86f0b6a-069b-49ec-98d1-7a9e74efbb24%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/CAG9Y3D8ekKsrZZ7x1gZ-zWCLJ56Uo1GHaPoiqRKsim-d5xhXcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django project

2019-05-06 Thread Rob W
Yes, I’m a beginner too, but need to get it completed.  The first piece should 
not be too difficult.



> On May 6, 2019, at 10:32 AM, fazal rehman  wrote:
> 
> Is it for beginners ?
> 
> On Mon 6 May, 2019, 8:01 PM ,  > wrote:
> I am looking for 2 people to work with me on a django project.
> 
> if you are interested, email me.
> 
> randmwhee...@gmail.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/a86f0b6a-069b-49ec-98d1-7a9e74efbb24%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/CAG9Y3D8ekKsrZZ7x1gZ-zWCLJ56Uo1GHaPoiqRKsim-d5xhXcQ%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/B908B907-A71A-4EC5-8910-39778B9118B9%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django project

2019-05-06 Thread fazal rehman
Send me the details..

On Mon 6 May, 2019, 8:04 PM Rob W,  wrote:

> Yes, I’m a beginner too, but need to get it completed.  The first piece
> should not be too difficult.
>
>
>
> On May 6, 2019, at 10:32 AM, fazal rehman 
> wrote:
>
> Is it for beginners ?
>
> On Mon 6 May, 2019, 8:01 PM ,  wrote:
>
>> I am looking for 2 people to work with me on a django project.
>>
>> if you are interested, email me.
>>
>> randmwhee...@gmail.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/a86f0b6a-069b-49ec-98d1-7a9e74efbb24%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/CAG9Y3D8ekKsrZZ7x1gZ-zWCLJ56Uo1GHaPoiqRKsim-d5xhXcQ%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/B908B907-A71A-4EC5-8910-39778B9118B9%40gmail.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/CAG9Y3D8N%2BExowW%3D6U6Wur75rTx-vEbGpKLF9%2BqPvt%2BNNNehs1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django project

2019-05-06 Thread Pushkar Bhuse
Please send me the details too.

On Mon, 6 May 2019 at 8:05 PM, fazal rehman 
wrote:

> Send me the details..
>
> On Mon 6 May, 2019, 8:04 PM Rob W,  wrote:
>
>> Yes, I’m a beginner too, but need to get it completed.  The first piece
>> should not be too difficult.
>>
>>
>>
>> On May 6, 2019, at 10:32 AM, fazal rehman 
>> wrote:
>>
>> Is it for beginners ?
>>
>> On Mon 6 May, 2019, 8:01 PM ,  wrote:
>>
>>> I am looking for 2 people to work with me on a django project.
>>>
>>> if you are interested, email me.
>>>
>>> randmwhee...@gmail.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/a86f0b6a-069b-49ec-98d1-7a9e74efbb24%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/CAG9Y3D8ekKsrZZ7x1gZ-zWCLJ56Uo1GHaPoiqRKsim-d5xhXcQ%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/B908B907-A71A-4EC5-8910-39778B9118B9%40gmail.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/CAG9Y3D8N%2BExowW%3D6U6Wur75rTx-vEbGpKLF9%2BqPvt%2BNNNehs1Q%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/CALLiNkj29y9r6SRQKL23hv3NYZaccxHVCDRHxaLOqwiVyKgvFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django project

2019-05-06 Thread Rob W
https://drive.google.com/file/d/1rxXhfNVYq8mapSeaEapuLLsfPc4eaNDR/view?usp=sharing

> On May 6, 2019, at 10:41 AM, Pushkar Bhuse  wrote:
> 
> Please send me the details too.
> 
> On Mon, 6 May 2019 at 8:05 PM, fazal rehman  > wrote:
> Send me the details..
> 
> On Mon 6 May, 2019, 8:04 PM Rob W,  > wrote:
> Yes, I’m a beginner too, but need to get it completed.  The first piece 
> should not be too difficult.
> 
> 
> 
>> On May 6, 2019, at 10:32 AM, fazal rehman > > wrote:
>> 
>> Is it for beginners ?
>> 
>> On Mon 6 May, 2019, 8:01 PM , > > wrote:
>> I am looking for 2 people to work with me on a django project.
>> 
>> if you are interested, email me.
>> 
>> randmwhee...@gmail.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/a86f0b6a-069b-49ec-98d1-7a9e74efbb24%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/CAG9Y3D8ekKsrZZ7x1gZ-zWCLJ56Uo1GHaPoiqRKsim-d5xhXcQ%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/B908B907-A71A-4EC5-8910-39778B9118B9%40gmail.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/CAG9Y3D8N%2BExowW%3D6U6Wur75rTx-vEbGpKLF9%2BqPvt%2BNNNehs1Q%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@googlegrou

Re: (Help Me !) How to extract name attribute of element from instantiated form object inside views.py

2019-05-06 Thread Mayur Bagul
thanks !


for solution it will be helpful to me.

On Monday, May 6, 2019 at 7:01:07 PM UTC+5:30, Jamiu Olashile Salimon wrote:
>
> use this to access the city_name field value;
>
> form.cleaned_data[“city_name”]
>
> Use to a print statement to see for yourself.
>
> On Mon, 6 May 2019 at 1:42 PM, Mayur Bagul  > wrote:
>
>> Hello Community,
>>
>> I've been stuck to this problem from one week. I have read Django Doc. 
>> and i found little bit relevant to my problem.
>>
>> *Form.py* 
>>
>>
>> from django import forms
>>
>> class NameForm(forms.Form):
>> city_name = forms.CharField(label='city name', max_length=100)
>>  
>>
>>
>> *Views.py*
>>
>>
>>
>> from django.http import HttpResponseRedirect
>> from django.shortcuts import render
>>
>> from .forms import NameForm
>>
>> def get_name(request):
>>   
>> if request.method == 'POST':
>> 
>> form = NameForm(request.POST)
>>   
>>  * # Here i wanted to extract value stored inside Text Box*  *How i 
>> can do that?*
>>
>>  *#i wanted to extract city entered by user and store into another 
>> variable how to do it?*
>>
>>  *# i wanted to use that variable to put it for filter *
>>
>>
>>info = Data.objects.filter(city__exact=*'city'*) 
>>
>>above line is for retrieving  record for entered city 
>> from database.
>>
>>
>>return render(request, 'name.html', {'info': info}) 
>>
>> else:
>> form = NameForm()
>>
>> return render(request, 'name.html', {'form': form})
>>
>>
>>
>>
>> *Please help me with this guys !*
>>
>> *i really need help on this because im not getting syntax for this on any 
>> resource.*
>>
>> *Thanking you.*
>>
>> -- 
>> 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...@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/666102fa-661e-4330-97f1-1414d7b08bce%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/4f04c728-62f4-4b16-b09d-a8d474b64b69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: (Help Me !) How to extract name attribute of element from instantiated form object inside views.py

2019-05-06 Thread salimon jamiu olashile
You’re welcome

On Mon, 6 May 2019 at 5:08 PM, Mayur Bagul  wrote:

> thanks !
>
>
> for solution it will be helpful to me.
>
> On Monday, May 6, 2019 at 7:01:07 PM UTC+5:30, Jamiu Olashile Salimon
> wrote:
>>
>> use this to access the city_name field value;
>>
>> form.cleaned_data[“city_name”]
>>
>> Use to a print statement to see for yourself.
>>
>> On Mon, 6 May 2019 at 1:42 PM, Mayur Bagul  wrote:
>>
> Hello Community,
>>>
>>> I've been stuck to this problem from one week. I have read Django Doc.
>>> and i found little bit relevant to my problem.
>>>
>>> *Form.py*
>>>
>>>
>>> from django import forms
>>>
>>> class NameForm(forms.Form):
>>> city_name = forms.CharField(label='city name', max_length=100)
>>>
>>>
>>>
>>> *Views.py*
>>>
>>>
>>>
>>> from django.http import HttpResponseRedirect
>>> from django.shortcuts import render
>>>
>>> from .forms import NameForm
>>>
>>> def get_name(request):
>>>
>>> if request.method == 'POST':
>>>
>>> form = NameForm(request.POST)
>>>
>>>  * # Here i wanted to extract value stored inside Text Box*  *How i
>>> can do that?*
>>>
>>>  *#i wanted to extract city entered by user and store into another
>>> variable how to do it?*
>>>
>>>  *# i wanted to use that variable to put it for filter *
>>>
>>>
>>>info = Data.objects.filter(city__exact=*'city'*)
>>>
>>>above line is for retrieving  record for entered city
>>> from database.
>>>
>>>
>>>return render(request, 'name.html', {'info': info})
>>>
>>> else:
>>> form = NameForm()
>>>
>>> return render(request, 'name.html', {'form': form})
>>>
>>>
>>>
>>>
>>> *Please help me with this guys !*
>>>
>>> *i really need help on this because im not getting syntax for this on
>>> any resource.*
>>>
>>> *Thanking you.*
>>>
>>> --
>>> 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...@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/666102fa-661e-4330-97f1-1414d7b08bce%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/4f04c728-62f4-4b16-b09d-a8d474b64b69%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/CAFhdOCN3gNRJSMG58KCMr-osOy915SSkDB5vndc6xT691nvKWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread bob
I've inherited an application written django 1.11. The old application uses 
raw() with INNER JOIN and GROUP BY. 
 I cannot seem to figure out how to do inner join and group by properly the 
ORM way.

The raw() query is below.

SELECT * FROM items_monolithic
INNER JOIN items_facepng
ON items_monolithic.object == items_facepng.obj
GROUP BY items_monolithic.object
ORDER BY object ASC


Things kind of work with raw() but that doesn't feel right. And I get nasty 
warnings about RawQuerySet not supporting certain things when I try to use 
the query set that is returned.

>From what I understand every monolithic object has 1 or more faces 
(graphic/picture).

I would call the monolithic a one-to-many relationship with facepng but I 
see django calls this a ForeignKey.

I'm working with these models (yes, a field named object is "bad", it's 
what I was given)


class Monolithic(models.Model):
object = models.CharField(max_length=128, blank=False, null=False, unique=
True)

class FacePng(models.Model):
obj = models.CharField(max_length=128, blank=True, null=True)


I do not see the ForeignKey relationship between Monolithic and FacePng. 

Changing Monolithic class to models.ForeignKey() breaks lots of things.

So I'd prefer to figure out how to do the inner join and group by query but 
if that's not the django way and I need to change Monolithic.objects to a 
ForeignKey() and fix all the stuff that is broken I can do that that too. 

Just need some guidance on how to proceed.



-- 
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/ab7ecf5b-9ae8-4428-9502-6b7d5dec03b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Handling multiple protocols in Channels 2

2019-05-06 Thread Andrea Conti

Ok, but that doesnt'solve the problem with handling the events in the right 
process.

Anyway, I think I figured it out. It seems there is nothing magical to a 
'protocol handler' after all, so I can just create a thread with its event 
loop and run the MQTT listener in there. No other processes required, and I 
don't even need to use a channel layer as long as I can live without the 
group facilities.

Runs fine in development mode, let's hope it does not blow up with an 
external ASGI server.

andrea

On Monday, May 6, 2019 at 6:26:52 AM UTC+2, Fly Style wrote:
>
> for example:
>
> from asgiref.sync import async_to_sync as a2s
> from channels.layers import get_channel_layer
> from channels_mqtt import settings
>
>
> event = {"type": settings.MQTT_PUBLISH, "text": {"topic": topic, "payload"
> : payload, "qos": qos, "retain": retain}}
> a2s(channel_layer.send)(channel, event)
>
>

-- 
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/ba3fe782-9efe-4bc9-a5af-d9c10fc9f2f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread Matthew Pava
That design could definitely be improved, and it will have to be in order to 
use the ORM effectively. Then you’d have to change every reference to the 
fields in all the raw querysets in the app.

You need a ForeignKey relationship between the two models, which is an integer 
value, not a char. You’d have to do migrations to get this adjusted properly.

Add a facepng_id Integer Field to Monolith. Run makemigrations. Add a RunSQL 
command to the new migrations file 
(https://docs.djangoproject.com/en/2.2/ref/migration-operations/#runsql).  
Something like this:
Update items_monolith SET facepng_id=items_monolith.id FROM items_monolith 
INNER JOIN items_facepng ON items_monolith.object=items_facepng.obj

Then delete the object and obj fields from the models. Run makemigrations 
again. Verify that your app doesn’t reference those fields anywhere else.

Then you could access facepng like so:
monolithic.facepng_set

Of course, this is just a very rough idea of what to do, and I’m not sure what 
the whole structure of your tables is.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of b...@tanners.org
Sent: Monday, May 6, 2019 11:28 AM
To: Django users
Subject: ORM help with INNER JOIN and GROUP BY

I've inherited an application written django 1.11. The old application uses 
raw() with INNER JOIN and GROUP BY.
 I cannot seem to figure out how to do inner join and group by properly the ORM 
way.

The raw() query is below.

SELECT  * FROM items_monolithic
INNER JOIN items_facepng
ON items_monolithic.object == items_facepng.obj
GROUP BY items_monolithic.object
ORDER BY object ASC


Things kind of work with raw() but that doesn't feel right. And I get nasty 
warnings about RawQuerySet not supporting certain things when I try to use the 
query set that is returned.

>From what I understand every monolithic object has 1 or more faces 
>(graphic/picture).

I would call the monolithic a one-to-many relationship with facepng but I see 
django calls this a ForeignKey.

I'm working with these models (yes, a field named object is "bad", it's what I 
was given)


class Monolithic(models.Model):
   object = models.CharField(max_length=128, blank=False, null=False, 
unique=True)

class FacePng(models.Model):
obj = models.CharField(max_length=128, blank=True, null=True)


I do not see the ForeignKey relationship between Monolithic and FacePng.

Changing Monolithic class to models.ForeignKey() breaks lots of things.

So I'd prefer to figure out how to do the inner join and group by query but if 
that's not the django way and I need to change Monolithic.objects to a 
ForeignKey() and fix all the stuff that is broken I can do that that too.

Just need some guidance on how to proceed.



--
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/ab7ecf5b-9ae8-4428-9502-6b7d5dec03b5%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/573f67effc814147bb18f8e4327d2c23%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread Kevin Jay
The field within your class should be set to ForeignKey.


Try this:
Object = models.ForeignKey(‘FacePng’, on_delete=SET_NULL, max_length= some_int)

on_delete and max_length need to be set based on your requirements 

Sent from my iPhone

> On May 6, 2019, at 11:28 AM, b...@tanners.org wrote:
> 
> I've inherited an application written django 1.11. The old application uses 
> raw() with INNER JOIN and GROUP BY. 
>  I cannot seem to figure out how to do inner join and group by properly the 
> ORM way.
> 
> The raw() query is below.
> 
> SELECT  * FROM items_monolithic
> INNER JOIN items_facepng
> ON items_monolithic.object == items_facepng.obj
> GROUP BY items_monolithic.object
> ORDER BY object ASC
> 
> 
> Things kind of work with raw() but that doesn't feel right. And I get nasty 
> warnings about RawQuerySet not supporting certain things when I try to use 
> the query set that is returned.
> 
> From what I understand every monolithic object has 1 or more faces 
> (graphic/picture).
> 
> I would call the monolithic a one-to-many relationship with facepng but I see 
> django calls this a ForeignKey.
> 
> I'm working with these models (yes, a field named object is "bad", it's what 
> I was given)
> 
> 
> class Monolithic(models.Model):
> object = models.CharField(max_length=128, blank=False, null=False, 
> unique=True)
> 
> class FacePng(models.Model):
> obj = models.CharField(max_length=128, blank=True, null=True)
> 
> 
> I do not see the ForeignKey relationship between Monolithic and FacePng. 
> 
> Changing Monolithic class to models.ForeignKey() breaks lots of things.
> 
> So I'd prefer to figure out how to do the inner join and group by query but 
> if that's not the django way and I need to change Monolithic.objects to a 
> ForeignKey() and fix all the stuff that is broken I can do that that too. 
> 
> Just need some guidance on how to proceed.
> 
> 
> 
> -- 
> 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/ab7ecf5b-9ae8-4428-9502-6b7d5dec03b5%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/D5B5695B-D057-4D4D-8F53-2BAF1D6B666A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread bob
Just want to make sure I understand. ForeighKeys need to be integers?

Only integers?


You need a ForeignKey relationship between the two models, which is an 
> integer value, not a char. You’d have to do migrations to get this adjusted 
> properly.  
>

-- 
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/9697de34-3d20-4023-81a7-8ea9f257f7f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Info

2019-05-06 Thread charan
No folk
No need to pay

Sent from Mail for Windows 10

From: Soumen Khatua
Sent: 06 May 2019 16:52
To: django-users@googlegroups.com
Subject: Info

Hi Folks,

Should I need to pay for asking questions or problem in this group?


Thank You
-- 
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/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%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/5cd0752a.1c69fb81.cdc85.081b%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


RE: ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread Matthew Pava
Well, I had always assumed that they do need to be integers, but it looks like 
this has been discussed at length.
https://groups.google.com/forum/#!topic/django-users/0utRzn98Wxo

It does seem clear, though, that the superior database design uses integers for 
ForeignKeys.
And I didn’t find a way to make it clear to Django not to use an Integer 
ForeignKey.  Maybe something to do with the primary_key attribute on a 
CharField?

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of b...@tanners.org
Sent: Monday, May 6, 2019 12:44 PM
To: Django users
Subject: Re: ORM help with INNER JOIN and GROUP BY

Just want to make sure I understand. ForeighKeys need to be integers?

Only integers?


You need a ForeignKey relationship between the two models, which is an integer 
value, not a char. You’d have to do migrations to get this adjusted properly.
--
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/9697de34-3d20-4023-81a7-8ea9f257f7f1%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/27eee43ff8024c98bcf9a5e9cd4bfd89%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Info

2019-05-06 Thread Soumen Khatua
Then why one bit bounce application is coming everytime after sending any
problem and saying if you will pay the we will allow your request to our
inbox.

Thanks buddy for help.



On Mon, 6 May 2019, 23:25 charan,  wrote:

> No folk
>
> No need to pay
>
>
>
> Sent from Mail  for
> Windows 10
>
>
>
> *From: *Soumen Khatua 
> *Sent: *06 May 2019 16:52
> *To: *django-users@googlegroups.com
> *Subject: *Info
>
>
>
> Hi Folks,
>
>
>
> Should I need to pay for asking questions or problem in this group?
>
>
>
>
>
> Thank You
>
> --
> 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/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%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/5cd0752a.1c69fb81.cdc85.081b%40mx.google.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/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Info

2019-05-06 Thread Alex Heyden
When a message goes out to here, it's sent to everyone on the group. When
you reply to it, it also goes out to the group. What you're seeing is
someone's auto-reply. I couldn't say for sure if it's a malicious attempt
to passively get some money or if it's someone not realizing his personal
spam filter is spamming a bunch of people in the group. Either way, just
block the sender and ignore it.

On Mon, May 6, 2019 at 1:49 PM Soumen Khatua 
wrote:

> Then why one bit bounce application is coming everytime after sending any
> problem and saying if you will pay the we will allow your request to our
> inbox.
>
> Thanks buddy for help.
>
>
>
> On Mon, 6 May 2019, 23:25 charan,  wrote:
>
>> No folk
>>
>> No need to pay
>>
>>
>>
>> Sent from Mail  for
>> Windows 10
>>
>>
>>
>> *From: *Soumen Khatua 
>> *Sent: *06 May 2019 16:52
>> *To: *django-users@googlegroups.com
>> *Subject: *Info
>>
>>
>>
>> Hi Folks,
>>
>>
>>
>> Should I need to pay for asking questions or problem in this group?
>>
>>
>>
>>
>>
>> Thank You
>>
>> --
>> 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/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%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/5cd0752a.1c69fb81.cdc85.081b%40mx.google.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/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%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/CA%2Bv0ZYWD62dqujZoQ7EbhFZvXXCfNeFhT%2BbHnQuQiBXBE9kyFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Info

2019-05-06 Thread Soumen Khatua
Thanks guys for your help.



On Tue, 7 May 2019, 00:24 Ahmed Ishtiaque,  wrote:

> Ignore that. I think it's someone who's set up a ploy for that e-mail to
> be replied back to get some free money.
>
> On Mon, May 6, 2019 at 2:50 PM Soumen Khatua 
> wrote:
>
>> Then why one bit bounce application is coming everytime after sending any
>> problem and saying if you will pay the we will allow your request to our
>> inbox.
>>
>> Thanks buddy for help.
>>
>>
>>
>> On Mon, 6 May 2019, 23:25 charan,  wrote:
>>
>>> No folk
>>>
>>> No need to pay
>>>
>>>
>>>
>>> Sent from Mail  for
>>> Windows 10
>>>
>>>
>>>
>>> *From: *Soumen Khatua 
>>> *Sent: *06 May 2019 16:52
>>> *To: *django-users@googlegroups.com
>>> *Subject: *Info
>>>
>>>
>>>
>>> Hi Folks,
>>>
>>>
>>>
>>> Should I need to pay for asking questions or problem in this group?
>>>
>>>
>>>
>>>
>>>
>>> Thank You
>>>
>>> --
>>> 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/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%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/5cd0752a.1c69fb81.cdc85.081b%40mx.google.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/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%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/CAKizqR6kw3fwfWjp%3Dc8Y3yW5%3DXKO7uH9eGm64q8L02ZO2zSCxg%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/CAPUw6WZ5fCVeOZQP1nyQm7SG%2BBC-CX4pg%3Db4JAkvgaG9-_hBRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Info

2019-05-06 Thread Ahmed Ishtiaque
Ignore that. I think it's someone who's set up a ploy for that e-mail to be
replied back to get some free money.

On Mon, May 6, 2019 at 2:50 PM Soumen Khatua 
wrote:

> Then why one bit bounce application is coming everytime after sending any
> problem and saying if you will pay the we will allow your request to our
> inbox.
>
> Thanks buddy for help.
>
>
>
> On Mon, 6 May 2019, 23:25 charan,  wrote:
>
>> No folk
>>
>> No need to pay
>>
>>
>>
>> Sent from Mail  for
>> Windows 10
>>
>>
>>
>> *From: *Soumen Khatua 
>> *Sent: *06 May 2019 16:52
>> *To: *django-users@googlegroups.com
>> *Subject: *Info
>>
>>
>>
>> Hi Folks,
>>
>>
>>
>> Should I need to pay for asking questions or problem in this group?
>>
>>
>>
>>
>>
>> Thank You
>>
>> --
>> 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/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%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/5cd0752a.1c69fb81.cdc85.081b%40mx.google.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/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%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/CAKizqR6kw3fwfWjp%3Dc8Y3yW5%3DXKO7uH9eGm64q8L02ZO2zSCxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Info

2019-05-06 Thread Soumen Khatua
Okay


Thank you for your help.

On Tue, 7 May 2019, 00:26 Alex Heyden,  wrote:

> When a message goes out to here, it's sent to everyone on the group. When
> you reply to it, it also goes out to the group. What you're seeing is
> someone's auto-reply. I couldn't say for sure if it's a malicious attempt
> to passively get some money or if it's someone not realizing his personal
> spam filter is spamming a bunch of people in the group. Either way, just
> block the sender and ignore it.
>
> On Mon, May 6, 2019 at 1:49 PM Soumen Khatua 
> wrote:
>
>> Then why one bit bounce application is coming everytime after sending any
>> problem and saying if you will pay the we will allow your request to our
>> inbox.
>>
>> Thanks buddy for help.
>>
>>
>>
>> On Mon, 6 May 2019, 23:25 charan,  wrote:
>>
>>> No folk
>>>
>>> No need to pay
>>>
>>>
>>>
>>> Sent from Mail  for
>>> Windows 10
>>>
>>>
>>>
>>> *From: *Soumen Khatua 
>>> *Sent: *06 May 2019 16:52
>>> *To: *django-users@googlegroups.com
>>> *Subject: *Info
>>>
>>>
>>>
>>> Hi Folks,
>>>
>>>
>>>
>>> Should I need to pay for asking questions or problem in this group?
>>>
>>>
>>>
>>>
>>>
>>> Thank You
>>>
>>> --
>>> 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/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%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/5cd0752a.1c69fb81.cdc85.081b%40mx.google.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/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%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/CA%2Bv0ZYWD62dqujZoQ7EbhFZvXXCfNeFhT%2BbHnQuQiBXBE9kyFg%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/CAPUw6WYHS-iR6SO2%2BuOqHPqNgwcg%2BW2B23uiJuj4AmdvyM_KHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread Kevin Jay
 Maybe that was a typo?
The foreignkey relationship would look like this:
object = models.ForeignKey(FacePng'', max_length=128, blank=False,
null=False, unique=True)

On Mon, May 6, 2019 at 12:44 PM  wrote:

> Just want to make sure I understand. ForeighKeys need to be integers?
>
> Only integers?
>
>
> You need a ForeignKey relationship between the two models, which is an
>> integer value, not a char. You’d have to do migrations to get this adjusted
>> properly.
>>
> --
> 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/9697de34-3d20-4023-81a7-8ea9f257f7f1%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/CAEtabwfknJFSeHiYLcLdQ6-0soywHaHwsPz8SLm_T24tbT0Hpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread bob
class Monolithic(models.Model):
facepng_id = models.IntegerField(blank=True, null=True)


facepng_id as Integer not ForeignKey?


> UPDATE items_monolithic SET facepng_id=items_monolithic.id FROM 
items_monolithic INNER JOIN items_facepng ON 
items_monolithic.object=items_facepng.obj ;
Error: near "from": syntax error
 
I'll keep working on the code.

Add a facepng_id Integer Field to Monolith. Run makemigrations. Add a 
> RunSQL command to the new migrations file (
> https://docs.djangoproject.com/en/2.2/ref/migration-operations/#runsql).  
> Something like this:
>
> Update items_monolith SET facepng_id=items_monolith.id FROM 
> items_monolith INNER JOIN items_facepng ON 
> items_monolith.object=items_facepng.obj 
>
>  
>
> Then delete the object and obj fields from the models. Run makemigrations 
> again. Verify that your app doesn’t reference those fields anywhere else.
>
>  
>
> Then you could access facepng like so:
>
> monolithic.facepng_set
>
>  
>
> Of course, this is just a very rough idea of what to do, and I’m not sure 
> what the whole structure of your tables is.
>
>  
>
> *From:* django...@googlegroups.com  [mailto:
> django...@googlegroups.com ] *On Behalf Of *b...@tanners.org 
> 
> *Sent:* Monday, May 6, 2019 11:28 AM
> *To:* Django users
> *Subject:* ORM help with INNER JOIN and GROUP BY
>
>  
>
> I've inherited an application written django 1.11. The old application 
> uses raw() with INNER JOIN and GROUP BY. 
>
>  I cannot seem to figure out how to do inner join and group by properly 
> the ORM way.
>
>  
>
> The raw() query is below.
>
>  
>
> SELECT  * FROM items_monolithic
>
> INNER JOIN items_facepng
>
> ON items_monolithic.object == items_facepng.obj
>
> GROUP BY items_monolithic.object
>
> ORDER BY object ASC
>
>  
>
>  
>
> Things kind of work with raw() but that doesn't feel right. And I get 
> nasty warnings about RawQuerySet not supporting certain things when I try 
> to use the query set that is returned.
>
>  
>
> From what I understand every monolithic object has 1 or more faces 
> (graphic/picture).
>
>  
>
> I would call the monolithic a one-to-many relationship with facepng but I 
> see django calls this a ForeignKey.
>
>  
>
> I'm working with these models (yes, a field named object is "bad", it's 
> what I was given)
>
>  
>
>  
>
> class Monolithic(models.Model):
>
>object = models.CharField(max_length=128, blank=False, null=False, 
> unique=True)
>
>  
>
> class FacePng(models.Model):
>
> obj = models.CharField(max_length=128, blank=True, null=True)
>
>  
>
>  
>
> I do not see the ForeignKey relationship between Monolithic and FacePng. 
>
>  
>
> Changing Monolithic class to models.ForeignKey() breaks lots of things.
>
>  
>
> So I'd prefer to figure out how to do the inner join and group by query 
> but if that's not the django way and I need to change Monolithic.objects to 
> a ForeignKey() and fix all the stuff that is broken I can do that that too. 
>
>  
>
> Just need some guidance on how to proceed.
>
>  
>
>  
>
>  
>
> -- 
> 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...@googlegroups.com .
> To post to this group, send email to djang...@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/ab7ecf5b-9ae8-4428-9502-6b7d5dec03b5%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/7af29fa6-5cfc-4bda-a471-ed8ee26b37ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ORM help with INNER JOIN and GROUP BY

2019-05-06 Thread Kevin Jay
You are correct.
Django creates a primary key of 'id' for each table as an integer by
default. So foreignkey will reference that primary key which by default is
an integer.
If the primary key is changed to some other type, Django can still handle
it.
Apparently using integers is the more efficient method.

On Mon, May 6, 2019 at 12:54 PM Matthew Pava  wrote:

> Well, I had always assumed that they do need to be integers, but it looks
> like this has been discussed at length.
>
> https://groups.google.com/forum/#!topic/django-users/0utRzn98Wxo
>
>
>
> It does seem clear, though, that the superior database design uses
> integers for ForeignKeys.
>
> And I didn’t find a way to make it clear to Django not to use an Integer
> ForeignKey.  Maybe something to do with the primary_key attribute on a
> CharField?
>
>
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *b...@tanners.org
> *Sent:* Monday, May 6, 2019 12:44 PM
> *To:* Django users
> *Subject:* Re: ORM help with INNER JOIN and GROUP BY
>
>
>
> Just want to make sure I understand. ForeighKeys need to be integers?
>
>
>
> Only integers?
>
>
>
>
>
> You need a ForeignKey relationship between the two models, which is an
> integer value, not a char. You’d have to do migrations to get this adjusted
> properly.
>
> --
> 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/9697de34-3d20-4023-81a7-8ea9f257f7f1%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/27eee43ff8024c98bcf9a5e9cd4bfd89%40iss2.ISS.LOCAL
> 
> .
> 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/CAEtabwdPi16kCzZAx6btpyRFGVn0JyaXGjL%2Bw8JTj2u6pHZxBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Info

2019-05-06 Thread Emmanuel Arias
Hi Soumen,

Do you have this message? Can you share us?

On 5/6/19 3:49 PM, Soumen Khatua wrote:
> Then why one bit bounce application is coming everytime after sending
> any problem and saying if you will pay the we will allow your request
> to our inbox.
>
> Thanks buddy for help. 
>
>
>
> On Mon, 6 May 2019, 23:25 charan,  > wrote:
>
> No folk
>
> No need to pay
>
>  
>
> Sent from Mail 
> for Windows 10
>
>  
>
> *From: *Soumen Khatua 
> *Sent: *06 May 2019 16:52
> *To: *django-users@googlegroups.com
> 
> *Subject: *Info
>
>  
>
> Hi Folks,
>
>  
>
> Should I need to pay for asking questions or problem in this group?
>
>  
>
>  
>
> Thank You
>
> -- 
> 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/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%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/5cd0752a.1c69fb81.cdc85.081b%40mx.google.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/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.

-- 
Emmanuel Arias
@eamanu
https://eamanu.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/7785bebb-0592-fe3a-77b0-1e21e258aaa1%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: django models

2019-05-06 Thread Skyisblue
Soumen,

The function looks to compare two Address objects. The as_data() call is
custom made. I saw it documented in your other post. It removes the Primary
Key and User from the Address object. I presume this is so they can compare
the hash of one address to the hash of another.

Regards,
Joe

On Mon, May 6, 2019 at 6:03 AM Soumen Khatua 
wrote:

> Hi Folks,
>
> How this underline code works?
>
>
> models.py
>
> class Address(models.Model):
> first_name = models.CharField(max_length=256, blank=True)
> last_name = models.CharField(max_length=256, blank=True)
> company_name = models.CharField(max_length=256, blank=True)
> street_address_1 = models.CharField(max_length=256, blank=True)
> street_address_2 = models.CharField(max_length=256, blank=True)
> city = models.CharField(max_length=256, blank=True)
> city_area = models.CharField(max_length=128, blank=True)
> postal_code = models.CharField(max_length=20, blank=True)
> country = CountryField()
> country_area = models.CharField(max_length=128, blank=True)
> phone = PossiblePhoneNumberField(blank=True, default='')
>
>
> *def __eq__(self, other):*
> *   return self.as_data() == other.as_data()*
> * __hash__ = models.Model.__hash__*
>
>
> Thank you.
>
>
>
>
>
>
>
>
>
>
>
>
> --
> 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/CAPUw6WY-pNGnPBHzDA%3DiRZUHY7NrmK30_dMbKiQpe%2B1n%2ByW%2BQQ%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/CAGgUuiuun1NebT1V5r2v3GGjSCJ4RybUw9Fsn1g4M6x1ei2VQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: WYSIWYG/Rich Text Editor recommendations

2019-05-06 Thread Tim Johnson
* Joel Mathew  [190430 17:29]:
> Currently I'm using quill. It's easy to implement, and has all basic
> features.

 Joel - perhaps you could check out another thread I started:
 subject - "quill tries to import deprecated django.forms.util"
 
 What version of django are you using?

 thanks again

-- 
Tim Johnson
http://www.tj49.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/20190507004739.GK2404%40mail.akwebsoft.com.
For more options, visit https://groups.google.com/d/optout.


Re: S3 Lifecycle expiration

2019-05-06 Thread Hardipinder Singh
Hey Britto,

What I meant was have a separate data script made with boto3 where you got
though every bucket id one at a time and set the values accordingly. Please
check the developer documentation for same. You’ll surely find a matching
function for this.

By services I meant that using django check the first you check for the
value entered by boto in db. Now you match it with the date of you choice
if it matches, call another function to update or use the data script.

All depends upon the way you wish to execute the whole code.

Regards
Hd

On Sat, 4 May 2019 at 19:29, Britto .  wrote:

> Not clear what are you referring with services.py. I know boto3 and
> django-storages. But how to configure it is the question.
>
> For boto3 there is a settings.py variable AWS_S3_OBJECT_PARAMETERS through
> that we could set expiration.
> Just wanted to make sure that how do we set different expiration for each
> object uploaded?
>
>
> Regards
> Britto
>
>
> On Sat, 4 May 2019 at 16:24, Hardipinder Singh 
> wrote:
>
>> Hey Britto,
>>
>> Check boto3 for this. Django can be used to check data using services.py.
>>
>> Hope this helps
>>
>> Thanks & Regards
>> Hardipinder Singh
>>
>> On 04-May-2019, at 13:39, Britto .  wrote:
>>
>> Hello All,
>>
>> How could we set S3 life-cycle expiration for a file from Django when
>> uploading to S3 back-end?
>>
>>
>> Regards
>> Britto
>>
>> --
>> 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/CAF0v3b5_0x4VfCSz9qaCkhGspPkfGyaR%3DgcdR1owbMTMWMqWBQ%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/D545031E-195C-44F3-8C19-802E0DA93A41%40gmail.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/CAF0v3b7Br0YaDbTgkbYgiRT4pSKENe5iApUtm_tU8HsEQ5jLKg%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/CABTc4VyFp0Bxy8-TyzAtthYu-xNNCPUP-po9VicF7VX4EA7bZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


outputting data from forms

2019-05-06 Thread Lutalo Bbosa joseph
am working on a project where my html template links to a form which has
values am supposed to use to calculate  the final value. am struggling to
write this logic any help please

-- 
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/CAMz%3Dh%3DRdavhp1mv1qQnuUZvi1SnDsjyMOwXxPOJayhAH_saTzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to perform additional actions on PasswordReset in Django

2019-05-06 Thread arriolasimon


I'm using django-axes for the locking of account when a user tries to enter 
credentials that are not recognized by the system, it will lock the account.


But when I do perform the password reset function using django auth package 
on a locked account, obviously there is no shortcut way to remove the lock 
of the account.


Even if the password is already reset, the account will still be locked by 
django-axes for a couple of minutes.


I'm trying to perform


python manage.py axes_reset_username


on the *class PasswordResetCompleteView* but I'm not sure how to access the 
username whose password was reset.

-- 
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/700dcec5-bce9-4d9a-8011-27ae091722ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django models

2019-05-06 Thread Soumen Khatua
Yes,You are right as_data is custom made function inside the same
class,here is the code:



def as_data(self):
"""Return the address as a dict suitable for passing as
kwargs.Result does not contain the primary key or an associated user."""
data = model_to_dict(self,exclude=['id','user'])
if isinstance(data['country'], Country):
data['country'] = data['country'].code
if isinstance(data['phone'], PhoneNumber):
#as_e164 is a phonenumber format information
data['phone'] = data['phone'].as_e164
return data


But here other is an argument so we need to pass it then without passing
how we can compare with self.as_data varibale?

Thank you for your response.

On Tue, May 7, 2019 at 2:19 AM Skyisblue  wrote:

> Soumen,
>
> The function looks to compare two Address objects. The as_data() call is
> custom made. I saw it documented in your other post. It removes the Primary
> Key and User from the Address object. I presume this is so they can compare
> the hash of one address to the hash of another.
>
> Regards,
> Joe
>
> On Mon, May 6, 2019 at 6:03 AM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>>
>> How this underline code works?
>>
>>
>> models.py
>>
>> class Address(models.Model):
>> first_name = models.CharField(max_length=256, blank=True)
>> last_name = models.CharField(max_length=256, blank=True)
>> company_name = models.CharField(max_length=256, blank=True)
>> street_address_1 = models.CharField(max_length=256, blank=True)
>> street_address_2 = models.CharField(max_length=256, blank=True)
>> city = models.CharField(max_length=256, blank=True)
>> city_area = models.CharField(max_length=128, blank=True)
>> postal_code = models.CharField(max_length=20, blank=True)
>> country = CountryField()
>> country_area = models.CharField(max_length=128, blank=True)
>> phone = PossiblePhoneNumberField(blank=True, default='')
>>
>>
>> *def __eq__(self, other):*
>> *   return self.as_data() == other.as_data()*
>> * __hash__ = models.Model.__hash__*
>>
>>
>> Thank you.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> 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/CAPUw6WY-pNGnPBHzDA%3DiRZUHY7NrmK30_dMbKiQpe%2B1n%2ByW%2BQQ%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/CAGgUuiuun1NebT1V5r2v3GGjSCJ4RybUw9Fsn1g4M6x1ei2VQw%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/CAPUw6Wbdko08d210HbV5uv8EBeWiC6Q%3D8LKdfyyYKHN--7__pA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django models

2019-05-06 Thread Soumen Khatua
Hi Folks,

I didn't  understand this code please help me to understand this code.

class AddressQueryset(models.QuerySet):
def annotate_default(self, user):
# Set default shipping/billing address pk to None
# if default shipping/billing address doesn't exist
default_shipping_address_pk, default_billing_address_pk = None, None
if user.default_shipping_address:
default_shipping_address_pk = user.default_shipping_address.pk
if user.default_billing_address:
default_billing_address_pk = user.default_billing_address.pk
return user.addresses.annotate(
user_default_shipping_address_pk=Value(
default_shipping_address_pk, models.IntegerField()),
user_default_billing_address_pk=Value(
default_billing_address_pk, models.IntegerField()))


default_shipping_address & default_billing_address_pk is available in my
User table it is a foreignkey of Address table  and  addresses is also
avialable in my User table as ManytoManytoField refering to same Address
Table and the last i'm using this inside Address table just like this :
objects = AddressQueryset.as_manager()



Thank You

-- 
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/CAPUw6Wbb9Emmq0aODhK9GmT9Z8X0TMQtSOsPJ-SA-99mpdT6sg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.