Tuesday, May 28, 2019

Re: How to restore Models original Properties - Problem in Models column Exclude

Dear  Alexis Roda Sir

Thank You very much for your nice reply. I check it.

On Tue, May 28, 2019 at 1:55 AM Alexis Roda <alexis.roda.villalonga@gmail.com> wrote:
Not an admin expert here.

You are modifying the modeladmin instance and, by the behavior you're describing, it looks like it is a global (shared) object. I'm guessing, you can confirm this by printing id(self) in add_view(). I'll bet you get the same value in each request, so the instance is shared, so the change is visible (persisted) across request boundaries.

You may think about adding self.exclude = () in the else branch in order to not exclude anything. Don't do that, you may end up leaking private information to dgp if both root and dgp are logged in at the same time.

Instead override the get_exclude method.


--
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+unsubscribe@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/CAMDYoXbb42hpu3jAATXTwxPw9kO8XeZpLOczbNa-Bzw5QAdGuQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Mr. Shetty Balaji S.
Asst. Professor
Department of Information Technology,
SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India
  Mobile: +91-9270696267

--
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+unsubscribe@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/CAECSbOv-cB_VgQgp6V6SgkyvpyxScJuoEOB2nwi3C%3D7Ahi6aWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment