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 <[email protected]>
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 [email protected].
> To post to this group, send email to [email protected].
> 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
> <https://groups.google.com/d/msgid/django-users/CAPUw6WY-pNGnPBHzDA%3DiRZUHY7NrmK30_dMbKiQpe%2B1n%2ByW%2BQQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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 [email protected].
To post to this group, send email to [email protected].
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.

Reply via email to