Re: Django Admin Shortcuts

2024-05-29 Thread Faisal Mahmood
Hi, First of all Sorry for the late reply😉

Okay👌 let's go...

It is generally not recommended to authenticate auto-generated users
directly from inspect_db without proper user model fields and permissions.
Here's why:

   -

   Security Concerns:
   - AbstractBaseUser and PermissionsMixin provide essential
  functionalities for user authentication and authorization. They
  handle password hashing, permissions management, and other security
  aspects. Bypassing these models might lead to vulnerabilities like
  storing passwords in plain text or granting unauthorized access.
   -

   Maintainability Issues:
   - Using inspect_db creates a tight coupling between your authentication
  logic and the specific database schema. This makes it difficult to
  modify the user model or switch databases in the future.

Here are some alternative approaches to consider:

   1.

   Migrate User Model Fields:
   - Gradually migrate your existing user model to include the necessary
  fields from AbstractBaseUser and PermissionsMixin. This ensures
  proper authentication and authorization mechanisms.
   2.

   Custom User Model:
   - Create a custom user model that inherits from AbstractBaseUser and
  includes any additional fields you need. This provides a more secure
  and maintainable approach.
   3.

   Alternative Authentication Methods:
   - Depending on your application's requirements, you might explore
  alternative authentication methods like API keys, tokens, or social
  logins. These can be suitable for non-human users or specific use
  cases.

While it might be technically possible to authenticate through inspect_db,
it's strongly advised against it due to the security and maintainability
drawbacks. Consider the alternative approaches mentioned above for a more
secure and robust solution.

On Wed, May 29, 2024, 3:06 AM utibe solomon  wrote:

> Hey bro is it possible to authenticate an auto generated user from
> inspect_db without necessarily having to migrate fields that come with
> using abstractbaseuser and permissions mixin
>
>
> On Tue, 28 May 2024 at 20:39, Mike Schem 
> wrote:
>
>> Hey Faisal,
>>
>> Thanks for taking the time to read the PR and provide some feedback. I
>> copied all of your concerns here and responded to them accordingly. Please
>> let me know if you have any further questions!
>>
>> 1.
>> Have you considered including a section in the Django admin documentation
>> that outlines the new shortcuts and how to use them?
>>
>> Yes, I absolutely will document this, I was thinking about adding it to
>> the "Other Topics" section here:
>> https://docs.djangoproject.com/en/5.0/ref/contrib/admin/#other-topics.
>> What do you think?
>>
>> 2.
>>  Are the keyboard shortcuts configurable?
>>
>> Not yet, but I would be open to doing this as a future PR.
>>
>> 3.
>> Have you tested the keyboard shortcuts across different browsers and
>> operating systems to ensure consistent behavior?
>>
>>  Any specific browsers or versions where you faced issues?
>>
>> Yes, we've tested on pretty much all major OSs and browsers and have seen
>> consistent behavior.  I've been running this in my company for over a year
>> now. It's been great!
>>
>> 4.
>> What considerations have been made regarding accessibility?
>>
>> I'd say this is largely an accessibility feature since it would allow for
>> the visually impaired to save without needing to see the save buttons,
>> which is great!
>>
>> 5.
>> How does the implementation handle potential conflicts with existing
>> browser or system shortcuts?
>>
>> There is an existing ctrl + S for saving browser pages as HTML, frakely,
>> I don't think that should be the default for users. When saving the page,
>> the action should not be to save it as html, but instead save the content
>> of the admin.
>>
>> 6.
>> Have you noticed any performance impacts with the addition of these
>> shortcuts? Ensuring that the admin interface remains performant is
>> important for all users.
>>
>> No, no performance issues. It's a very simple code change without much
>> impact.
>>
>> On Sat, May 25, 2024 at 7:25 AM Faisal Mahmood <
>> faisalbhagri2...@gmail.com> wrote:
>>
>>> Hi *Mike Schem,
>>>
>>> Thank you for reaching out and for your work on adding keyboard
>>> shortcuts to the Django admin. This is a valuable feature that can greatly
>>> enhance productivity for many users. We appreciate your contribution and
>>> the effort you've put into this PR.

Re: Django Admin Shortcuts

2024-05-28 Thread utibe solomon
Hey bro is it possible to authenticate an auto generated user from
inspect_db without necessarily having to migrate fields that come with
using abstractbaseuser and permissions mixin


On Tue, 28 May 2024 at 20:39, Mike Schem  wrote:

> Hey Faisal,
>
> Thanks for taking the time to read the PR and provide some feedback. I
> copied all of your concerns here and responded to them accordingly. Please
> let me know if you have any further questions!
>
> 1.
> Have you considered including a section in the Django admin documentation
> that outlines the new shortcuts and how to use them?
>
> Yes, I absolutely will document this, I was thinking about adding it to
> the "Other Topics" section here:
> https://docs.djangoproject.com/en/5.0/ref/contrib/admin/#other-topics.
> What do you think?
>
> 2.
>  Are the keyboard shortcuts configurable?
>
> Not yet, but I would be open to doing this as a future PR.
>
> 3.
> Have you tested the keyboard shortcuts across different browsers and
> operating systems to ensure consistent behavior?
>
>  Any specific browsers or versions where you faced issues?
>
> Yes, we've tested on pretty much all major OSs and browsers and have seen
> consistent behavior.  I've been running this in my company for over a year
> now. It's been great!
>
> 4.
> What considerations have been made regarding accessibility?
>
> I'd say this is largely an accessibility feature since it would allow for
> the visually impaired to save without needing to see the save buttons,
> which is great!
>
> 5.
> How does the implementation handle potential conflicts with existing
> browser or system shortcuts?
>
> There is an existing ctrl + S for saving browser pages as HTML, frakely, I
> don't think that should be the default for users. When saving the page, the
> action should not be to save it as html, but instead save the content of
> the admin.
>
> 6.
> Have you noticed any performance impacts with the addition of these
> shortcuts? Ensuring that the admin interface remains performant is
> important for all users.
>
> No, no performance issues. It's a very simple code change without much
> impact.
>
> On Sat, May 25, 2024 at 7:25 AM Faisal Mahmood 
> wrote:
>
>> Hi *Mike Schem,
>>
>> Thank you for reaching out and for your work on adding keyboard shortcuts
>> to the Django admin. This is a valuable feature that can greatly enhance
>> productivity for many users. We appreciate your contribution and the effort
>> you've put into this PR.
>>
>> We have reviewed your pull request and are excited about its potential.
>> Here are some thoughts and questions we have:
>>
>> 1.
>> Have you considered including a section in the Django admin documentation
>> that outlines the new shortcuts and how to use them?
>>
>> 2.
>>  Are the keyboard shortcuts configurable?
>>
>> 3.
>> Have you tested the keyboard shortcuts across different browsers and
>> operating systems to ensure consistent behavior?
>>
>>  Any specific browsers or versions where you faced issues?
>>
>> 4.
>> What considerations have been made regarding accessibility?
>>
>> 5.
>> How does the implementation handle potential conflicts with existing
>> browser or system shortcuts?
>>
>> 6.
>> Have you noticed any performance impacts with the addition of these
>> shortcuts? Ensuring that the admin interface remains performant is
>> important for all users.
>>
>> We believe these questions can help further refine the feature and ensure
>> it meets the needs of the wider Django community. Once again, thank you for
>> your contribution. We look forward to your responses and further discussion.
>>
>> Best regards,
>> [Faisal Mahmood]
>>
>> On Fri, May 24, 2024, 10:32 PM Mike Schem 
>> wrote:
>>
>>> Hey all,
>>>
>>> I’m seeking some support and feedback on my PR. I’ve added keyboard
>>> shortcuts to the Django admin for the save actions. We use it at my
>>> company, and it’s pretty helpful for power users. I’d love to hear what the
>>> community thinks.
>>>
>>> https://github.com/django/django/pull/17599
>>>
>>>
>>> Mike Schem
>>> Senior Software Engineer
>>> String King Lacrosse, LLC
>>> StringKing, Inc.
>>> 19100 South Vermont Avenue
>>> <https://www.google.com/maps/search/19100+South+Vermont+Avenue+Gardena,+CA%C2%A0+90248?entry=gmail&source=g>
>>> Gardena, CA  90248
>>> <https://www.google.com/maps/search/19100+South

Re: Django Admin Shortcuts

2024-05-28 Thread Faisal Mahmood
█▀ █▀█ █▀█ █░
█▄ █▄█ █▄█ █▄

That's great to hear keep it up. And have  a great day ahead.
I'm nothing but a student of Django.
Hopefully my questions doesn't bother you too much. 😉
🎩
😍
👕👍Great!
👖
And once again thanks a lot🌹 for your hard work.
I will be glad if you need any assistance from me in the future.

Regards
Faisal Mahmood
faisalbhagri2...@gmail.com
WhatsApp:   +923013181026



On Wed, May 29, 2024, 12:38 AM Mike Schem  wrote:

> Hey Faisal,
>
> Thanks for taking the time to read the PR and provide some feedback. I
> copied all of your concerns here and responded to them accordingly. Please
> let me know if you have any further questions!
>
> 1.
> Have you considered including a section in the Django admin documentation
> that outlines the new shortcuts and how to use them?
>
> Yes, I absolutely will document this, I was thinking about adding it to
> the "Other Topics" section here:
> https://docs.djangoproject.com/en/5.0/ref/contrib/admin/#other-topics.
> What do you think?
>
> 2.
>  Are the keyboard shortcuts configurable?
>
> Not yet, but I would be open to doing this as a future PR.
>
> 3.
> Have you tested the keyboard shortcuts across different browsers and
> operating systems to ensure consistent behavior?
>
>  Any specific browsers or versions where you faced issues?
>
> Yes, we've tested on pretty much all major OSs and browsers and have seen
> consistent behavior.  I've been running this in my company for over a year
> now. It's been great!
>
> 4.
> What considerations have been made regarding accessibility?
>
> I'd say this is largely an accessibility feature since it would allow for
> the visually impaired to save without needing to see the save buttons,
> which is great!
>
> 5.
> How does the implementation handle potential conflicts with existing
> browser or system shortcuts?
>
> There is an existing ctrl + S for saving browser pages as HTML, frakely, I
> don't think that should be the default for users. When saving the page, the
> action should not be to save it as html, but instead save the content of
> the admin.
>
> 6.
> Have you noticed any performance impacts with the addition of these
> shortcuts? Ensuring that the admin interface remains performant is
> important for all users.
>
> No, no performance issues. It's a very simple code change without much
> impact.
>
> On Sat, May 25, 2024 at 7:25 AM Faisal Mahmood 
> wrote:
>
>> Hi *Mike Schem,
>>
>> Thank you for reaching out and for your work on adding keyboard shortcuts
>> to the Django admin. This is a valuable feature that can greatly enhance
>> productivity for many users. We appreciate your contribution and the effort
>> you've put into this PR.
>>
>> We have reviewed your pull request and are excited about its potential.
>> Here are some thoughts and questions we have:
>>
>> 1.
>> Have you considered including a section in the Django admin documentation
>> that outlines the new shortcuts and how to use them?
>>
>> 2.
>>  Are the keyboard shortcuts configurable?
>>
>> 3.
>> Have you tested the keyboard shortcuts across different browsers and
>> operating systems to ensure consistent behavior?
>>
>>  Any specific browsers or versions where you faced issues?
>>
>> 4.
>> What considerations have been made regarding accessibility?
>>
>> 5.
>> How does the implementation handle potential conflicts with existing
>> browser or system shortcuts?
>>
>> 6.
>> Have you noticed any performance impacts with the addition of these
>> shortcuts? Ensuring that the admin interface remains performant is
>> important for all users.
>>
>> We believe these questions can help further refine the feature and ensure
>> it meets the needs of the wider Django community. Once again, thank you for
>> your contribution. We look forward to your responses and further discussion.
>>
>> Best regards,
>> [Faisal Mahmood]
>>
>> On Fri, May 24, 2024, 10:32 PM Mike Schem 
>> wrote:
>>
>>> Hey all,
>>>
>>> I’m seeking some support and feedback on my PR. I’ve added keyboard
>>> shortcuts to the Django admin for the save actions. We use it at my
>>> company, and it’s pretty helpful for power users. I’d love to hear what the
>>> community thinks.
>>>
>>> https://github.com/django/django/pull/17599
>>>
>>>
>>> Mike Schem
>>> Senior Software Engineer
>>> String King Lacrosse, LLC
>>> StringKing, Inc.
>>> 19100 South 

Re: Django Admin Shortcuts

2024-05-28 Thread Mike Schem
Hey Faisal,

Thanks for taking the time to read the PR and provide some feedback. I
copied all of your concerns here and responded to them accordingly. Please
let me know if you have any further questions!

1.
Have you considered including a section in the Django admin documentation
that outlines the new shortcuts and how to use them?

Yes, I absolutely will document this, I was thinking about adding it to the
"Other Topics" section here:
https://docs.djangoproject.com/en/5.0/ref/contrib/admin/#other-topics. What
do you think?

2.
 Are the keyboard shortcuts configurable?

Not yet, but I would be open to doing this as a future PR.

3.
Have you tested the keyboard shortcuts across different browsers and
operating systems to ensure consistent behavior?

 Any specific browsers or versions where you faced issues?

Yes, we've tested on pretty much all major OSs and browsers and have seen
consistent behavior.  I've been running this in my company for over a year
now. It's been great!

4.
What considerations have been made regarding accessibility?

I'd say this is largely an accessibility feature since it would allow for
the visually impaired to save without needing to see the save buttons,
which is great!

5.
How does the implementation handle potential conflicts with existing
browser or system shortcuts?

There is an existing ctrl + S for saving browser pages as HTML, frakely, I
don't think that should be the default for users. When saving the page, the
action should not be to save it as html, but instead save the content of
the admin.

6.
Have you noticed any performance impacts with the addition of these
shortcuts? Ensuring that the admin interface remains performant is
important for all users.

No, no performance issues. It's a very simple code change without much
impact.

On Sat, May 25, 2024 at 7:25 AM Faisal Mahmood 
wrote:

> Hi *Mike Schem,
>
> Thank you for reaching out and for your work on adding keyboard shortcuts
> to the Django admin. This is a valuable feature that can greatly enhance
> productivity for many users. We appreciate your contribution and the effort
> you've put into this PR.
>
> We have reviewed your pull request and are excited about its potential.
> Here are some thoughts and questions we have:
>
> 1.
> Have you considered including a section in the Django admin documentation
> that outlines the new shortcuts and how to use them?
>
> 2.
>  Are the keyboard shortcuts configurable?
>
> 3.
> Have you tested the keyboard shortcuts across different browsers and
> operating systems to ensure consistent behavior?
>
>  Any specific browsers or versions where you faced issues?
>
> 4.
> What considerations have been made regarding accessibility?
>
> 5.
> How does the implementation handle potential conflicts with existing
> browser or system shortcuts?
>
> 6.
> Have you noticed any performance impacts with the addition of these
> shortcuts? Ensuring that the admin interface remains performant is
> important for all users.
>
> We believe these questions can help further refine the feature and ensure
> it meets the needs of the wider Django community. Once again, thank you for
> your contribution. We look forward to your responses and further discussion.
>
> Best regards,
> [Faisal Mahmood]
>
> On Fri, May 24, 2024, 10:32 PM Mike Schem 
> wrote:
>
>> Hey all,
>>
>> I’m seeking some support and feedback on my PR. I’ve added keyboard
>> shortcuts to the Django admin for the save actions. We use it at my
>> company, and it’s pretty helpful for power users. I’d love to hear what the
>> community thinks.
>>
>> https://github.com/django/django/pull/17599
>>
>>
>> Mike Schem
>> Senior Software Engineer
>> String King Lacrosse, LLC
>> StringKing, Inc.
>> 19100 South Vermont Avenue
>> <https://www.google.com/maps/search/19100+South+Vermont+Avenue+Gardena,+CA%C2%A0+90248?entry=gmail&source=g>
>> Gardena, CA  90248
>> <https://www.google.com/maps/search/19100+South+Vermont+Avenue+Gardena,+CA%C2%A0+90248?entry=gmail&source=g>
>> 310-699-7175 Mobile
>>
>> m...@stringking.com 
>> StringKing.com <http://stringkinglacrosse.com/> | uSTRING.com
>> <http://ustring.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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CALUzFO1GyhQct422sU6WDRC3ksYf-qg8qgtR%2BwXGOwrjWDn2_A%40mail.gmail.com
>> <https://groups.google.

Re: Django Admin Shortcuts

2024-05-25 Thread Faisal Mahmood
Hi *Mike Schem,

Thank you for reaching out and for your work on adding keyboard shortcuts
to the Django admin. This is a valuable feature that can greatly enhance
productivity for many users. We appreciate your contribution and the effort
you've put into this PR.

We have reviewed your pull request and are excited about its potential.
Here are some thoughts and questions we have:

1.
Have you considered including a section in the Django admin documentation
that outlines the new shortcuts and how to use them?

2.
 Are the keyboard shortcuts configurable?

3.
Have you tested the keyboard shortcuts across different browsers and
operating systems to ensure consistent behavior?

 Any specific browsers or versions where you faced issues?

4.
What considerations have been made regarding accessibility?

5.
How does the implementation handle potential conflicts with existing
browser or system shortcuts?

6.
Have you noticed any performance impacts with the addition of these
shortcuts? Ensuring that the admin interface remains performant is
important for all users.

We believe these questions can help further refine the feature and ensure
it meets the needs of the wider Django community. Once again, thank you for
your contribution. We look forward to your responses and further discussion.

Best regards,
[Faisal Mahmood]

On Fri, May 24, 2024, 10:32 PM Mike Schem  wrote:

> Hey all,
>
> I’m seeking some support and feedback on my PR. I’ve added keyboard
> shortcuts to the Django admin for the save actions. We use it at my
> company, and it’s pretty helpful for power users. I’d love to hear what the
> community thinks.
>
> https://github.com/django/django/pull/17599
>
>
> Mike Schem
> Senior Software Engineer
> String King Lacrosse, LLC
> StringKing, Inc.
> 19100 South Vermont Avenue
> <https://www.google.com/maps/search/19100+South+Vermont+Avenue+Gardena,+CA%C2%A0+90248?entry=gmail&source=g>
> Gardena, CA  90248
> <https://www.google.com/maps/search/19100+South+Vermont+Avenue+Gardena,+CA%C2%A0+90248?entry=gmail&source=g>
> 310-699-7175 Mobile
>
> m...@stringking.com 
> StringKing.com <http://stringkinglacrosse.com/> | uSTRING.com
> <http://ustring.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALUzFO1GyhQct422sU6WDRC3ksYf-qg8qgtR%2BwXGOwrjWDn2_A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALUzFO1GyhQct422sU6WDRC3ksYf-qg8qgtR%2BwXGOwrjWDn2_A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP3eejy%3DHWk82qHU5uNaWAYDTRC1-N1A9fUVkc%2B_avj5FmUYQA%40mail.gmail.com.


Django Admin Shortcuts

2024-05-24 Thread Mike Schem
Hey all,

I’m seeking some support and feedback on my PR. I’ve added keyboard
shortcuts to the Django admin for the save actions. We use it at my
company, and it’s pretty helpful for power users. I’d love to hear what the
community thinks.

https://github.com/django/django/pull/17599


Mike Schem
Senior Software Engineer
String King Lacrosse, LLC
StringKing, Inc.
19100 South Vermont Avenue
Gardena, CA  90248
310-699-7175 Mobile

m...@stringking.com 
StringKing.com <http://stringkinglacrosse.com/> | uSTRING.com
<http://ustring.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALUzFO1GyhQct422sU6WDRC3ksYf-qg8qgtR%2BwXGOwrjWDn2_A%40mail.gmail.com.


Wrong ordering of many-to-many fields with explicit intermediary model in Django admin

2023-11-01 Thread Alan Evangelista
Hi, all.

I have a Submission model with a many-to-many relationship with a Market 
model and explicitly defined a SubmissionMarket model as intermediary 
model. I have defined
Submission inlines in a ModelAdmin class (used by Django admin) and defined 
the markets field as the first one in the fields attribute of a form 
associated with that submission inline. However, that field is being shown 
by last (at the end of the inline row). 

Debugging, I found out that:

- django.forms.models.fields_for_model() creates a dict of form fields for 
a Django model. That function is used during the construction of any form.
- a form field defined in the Form.Meta.fields is ignored in 
fields_for_model() if formfield_callback is passed as argument and if that 
callable returns None
- django.forms.models.ModelFormMetaclass 
passes BaseModelAdmin.formfield_for_dbfield as formfield_callback arg in 
fields_for_model() 
- This formfield_for_dbfield() method ends up 
calling formfield_for_manytomany() if the field is m2m. The latter method 
returns None if the intermediary model was not created automatically by 
Django, which causes the field to be ignored. This is the code that does it 
in django/contrib/admin/options.py:

# If it uses an intermediary model that isn't auto created, don't 
show
# a field in admin.
if not db_field.remote_field.through._meta.auto_created:
return None

- Later, the markets field is added at the end of the form, I haven't 
investigated why.

My question is: what's the motivation of ignoring the m2m field if the 
intermediary model is not auto created? Could this behavior be customized?

Thanks in advance!

Regards,
Alan

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0974c9a3-3e03-42bb-a862-922ad68e329an%40googlegroups.com.


Django Admin Dropdown Filtering: Show Exam Class Related Students in Student Assign Field

2023-09-01 Thread Sabbir Hasan Munna
https://stackoverflow.com/q/77018469/9885741

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/07258dfa-8e8d-4f75-9977-b29b44f952e3n%40googlegroups.com.


Overriding the default django admin panel with a fully customized Rest Framework + React Dashboard

2023-04-15 Thread Kimanxo
Hello Devs, I Wish you're doing okay .

Im currently working on a Blood Analysis Lab related project, the project 
should provide basic website description and CRUD functionalities 
concerning the blood exams, their status, ...


Basically, I have a custom design for the admin panel where the website 
should be managed from, however , the built in django admin panel is 
lacking lot of features that i want to implement.


The question is :
Im using React with django, can I just create a custom template using react 
and rest framework and override the admin app ?
Meaning that if I go to localhost:8000/admin, it should no longer display 
the default django admin panel, instead it should display my fully custom 
react + drf driven dashboard.


If yes, please give me a good guide & resource to learn more about itx 
because most of the resources I found were simply changing CSS colors of 
the default panel.


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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9b12ce4b-698b-487d-9656-96216d5d3ff7n%40googlegroups.com.


Re: Django Admin does not use `get_FOO_display`

2023-04-05 Thread Opeoluwa Fatunmbi
The reason why your overridden get_status_display method is not being
applied in the Django admin is because the admin's display_for_field
function uses the flatchoices attribute of the field to retrieve the
display value of the field's current value.

The flatchoices attribute is a list of two-tuples that represent the
choices available for the field, flattened into a single list. The first
element of each tuple is the value, and the second element is the display
string. The display_for_field function uses the flatchoices list to
retrieve the display value of the current value, rather than calling the
field's get_FOO_display method.

To make use of your overridden get_status_display method in the admin, you
can set the flatchoices attribute of the field to None or remove the
attribute altogether. This will cause the admin to call the
get_status_display method instead of the display_for_field function.


class MyModelAdmin(admin.ModelAdmin): form = MyModelForm class
MyModelForm(forms.ModelForm): class Meta: model = MyModel fields =
'__all__' def __init__(self, *args, **kwargs): super().__init__(*args,
**kwargs) # Remove the flatchoices attribute of the status field
self.fields['status'].flatchoices = None

In this example, we're creating a MyModelForm that is used in the
MyModelAdmin. We're overriding the __init__ method of the form to remove
the flatchoices attribute of the status field, which will cause the admin
to call the get_status_display method instead.










On Tue, 4 Apr 2023 at 17:43, 'Ibrahim Abou Elenein' via Django users <
django-users@googlegroups.com> wrote:

> I had a model having a field that uses Choices
> status = FSMField(default=STATUSES.PENDING, choices=STATUSES,
> protected=True)
>
> I did override  the `get_status_display ` and its effect was not applied
> in the Django admin
>
> I looked up Django code and found
> ```
> def display_for_field(value, field, empty_value_display): from
> django.contrib.admin.templatetags.admin_list import _boolean_icon if
> getattr(field, "flatchoices", None): return
> dict(field.flatchoices).get(value, empty_value_display)
> ``` I changed it to use get_FOO_display and it worked,
> my question is why does it have this behavior? and how in my application
> can I make use of this?
>
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7dabd818-4b70-409e-8af3-482deb3an%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/7dabd818-4b70-409e-8af3-482deb3an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKVBneK9A4QZ72ibUzyHc60SsE6GY4Z7Gua29KObj9m-R%3DVLrA%40mail.gmail.com.


Django Admin does not use `get_FOO_display`

2023-04-04 Thread 'Ibrahim Abou Elenein' via Django users
I had a model having a field that uses Choices 
status = FSMField(default=STATUSES.PENDING, choices=STATUSES, 
protected=True)

I did override  the `get_status_display ` and its effect was not applied in 
the Django admin  

I looked up Django code and found 
```
def display_for_field(value, field, empty_value_display): from 
django.contrib.admin.templatetags.admin_list import _boolean_icon if 
getattr(field, "flatchoices", None): return 
dict(field.flatchoices).get(value, empty_value_display)
``` I changed it to use get_FOO_display and it worked, 
my question is why does it have this behavior? and how in my application 
can I make use of this?

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7dabd818-4b70-409e-8af3-482deb3an%40googlegroups.com.


Re: Django Admin

2023-03-24 Thread Jd Mehra

- 

Clear the browser cache and cookies and then try to log in again. Sometimes 
an old CSRF token can be stored in the browser cache and can cause issues.
- 




On Friday, 24 March 2023 at 07:50:37 UTC+5:30 Ikrombek wrote:

>
> Hello,
> How can I use dental teeth section. For example, do I need to include 32 
> fields from the model to specify 32 teeth, or is there a way to do it in 
> one?
> On Tuesday, March 14, 2023 at 5:39:27 AM UTC+5 Muhammad Juwaini Abdul 
> Rahman wrote:
>
>> In my previous case, I only use this:
>>
>> CSRF_TRUSTED_ORIGINS = ['https://your site url',]
>>
>> On Tue, 14 Mar 2023 at 04:33, Prosper Lekia  wrote:
>>
>>> This is how I deal with all csrf related issues.
>>>
>>> Make sure csrf MiddleWare is in your MiddleWare list 
>>>
>>> 'django.middleware.csrf.CsrfViewMiddleware'
>>>
>>> Add the settings below in your settings.py to prevent all csrf related 
>>> issues
>>>
>>> CSRF_TRUSTED_ORIGINS = ['https://your site url',]
>>> SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'http')
>>> CSRF_USE_SESSIONS = False
>>> CSRF_COOKIE_SECURE = True
>>> SECURE_BROWSER_XSS_FILTER = True
>>>
>>> CORS_ALLOW_CREDENTIALS = True
>>> CORS_ORIGIN_ALLOW_ALL = True
>>>
>>>
>>> SECURE_CONTENT_TYPE_NOSNIFF = True
>>> SECURE_FRAME_DENY = True
>>> SECURE_HSTS_SECONDS = 2592000
>>> SECURE_HSTS_INCLUDE_SUBDOMAINS = True
>>> SECURE_HSTS_PRELOAD = True
>>> X_FRAME_OPTIONS = 'SAMEORIGIN'
>>> SECURE_REFERRER_POLICY = 'same-origin
>>>
>>> On Saturday, March 11, 2023 at 7:04:40 PM UTC+1 James Hunt wrote:
>>>
 Hi there. I am fairly new to Django but have had previous success with 
 creating an app and being able to access the Admin page.
 Recently, if I attempt to access the admin page of a new Django app it 
 throws the CSRF error upon trying to log in!!!

 I have attempted several ways to bypass this error including adding 
 allowed hosts but I cant seem to get past this issue.

 Can someone please provide me with the definitive way of stopping CSRF 
 error when simply trying to access the admin part of Django? I mean there 
 are no post functions that really apply to this feature so I cant 
 understand the CSRF token.

 I cant get past this issue which means I can never access the admin 
 page!!

 Please help.

 Regards

 James

>>> -- 
>>>
>> You received this message because you are subscribed to the Google Groups 
>>> "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>>
>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/3f7e8ff3-3619-4ddf-8517-0ee3a613ed20n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/491c2ea0-c962-4392-9777-f95d1e873a62n%40googlegroups.com.


Re: Django Admin

2023-03-23 Thread Ikrombek

Hello,
How can I use dental teeth section. For example, do I need to include 32 
fields from the model to specify 32 teeth, or is there a way to do it in 
one?
On Tuesday, March 14, 2023 at 5:39:27 AM UTC+5 Muhammad Juwaini Abdul 
Rahman wrote:

> In my previous case, I only use this:
>
> CSRF_TRUSTED_ORIGINS = ['https://your site url',]
>
> On Tue, 14 Mar 2023 at 04:33, Prosper Lekia  wrote:
>
>> This is how I deal with all csrf related issues.
>>
>> Make sure csrf MiddleWare is in your MiddleWare list 
>>
>> 'django.middleware.csrf.CsrfViewMiddleware'
>>
>> Add the settings below in your settings.py to prevent all csrf related 
>> issues
>>
>> CSRF_TRUSTED_ORIGINS = ['https://your site url',]
>> SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'http')
>> CSRF_USE_SESSIONS = False
>> CSRF_COOKIE_SECURE = True
>> SECURE_BROWSER_XSS_FILTER = True
>>
>> CORS_ALLOW_CREDENTIALS = True
>> CORS_ORIGIN_ALLOW_ALL = True
>>
>>
>> SECURE_CONTENT_TYPE_NOSNIFF = True
>> SECURE_FRAME_DENY = True
>> SECURE_HSTS_SECONDS = 2592000
>> SECURE_HSTS_INCLUDE_SUBDOMAINS = True
>> SECURE_HSTS_PRELOAD = True
>> X_FRAME_OPTIONS = 'SAMEORIGIN'
>> SECURE_REFERRER_POLICY = 'same-origin
>>
>> On Saturday, March 11, 2023 at 7:04:40 PM UTC+1 James Hunt wrote:
>>
>>> Hi there. I am fairly new to Django but have had previous success with 
>>> creating an app and being able to access the Admin page.
>>> Recently, if I attempt to access the admin page of a new Django app it 
>>> throws the CSRF error upon trying to log in!!!
>>>
>>> I have attempted several ways to bypass this error including adding 
>>> allowed hosts but I cant seem to get past this issue.
>>>
>>> Can someone please provide me with the definitive way of stopping CSRF 
>>> error when simply trying to access the admin part of Django? I mean there 
>>> are no post functions that really apply to this feature so I cant 
>>> understand the CSRF token.
>>>
>>> I cant get past this issue which means I can never access the admin 
>>> page!!
>>>
>>> Please help.
>>>
>>> Regards
>>>
>>> James
>>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/3f7e8ff3-3619-4ddf-8517-0ee3a613ed20n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1746f7f-6bec-4031-9675-650d9bf41754n%40googlegroups.com.


Clickable link in django admin Panel

2023-03-22 Thread Gurami Tchumburidze


I have problem to display clickable link in django admin panel next to 
'icon' field or add help_text witch will be clickable and if i click on it, 
it must open this 'https://fonts.google.com/icons?icon.set=Material+Icons' 
website in new window of browther .

[image: .PNG]

link example : https://fonts.google.com/icons?icon.set=Material+Icons

I tried this but nothing happens, it shows just normal models without link 
and text.

**admin.py **
from .models import RaffleGame from django.utils.html import format_html 
from django.urls import reverse from django.contrib import admin class 
RaffleGameAdmin(admin.ModelAdmin): list_display = ('icon', 'link_to_google') 
def link_to_google(self, obj): url = 
'https://fonts.google.com/icons?icon.set=Material+Icons' link_text = 'click 
me for more info' return format_html('{}', url, link_text) 
link_to_google.short_description = 'Mehr Icons findest du hier' 
admin.site.register(RaffleGame, RaffleGameAdmin) 

*models.py*
class RaffleGame(models.Model): class GameStatus(models.TextChoices): 
scheduled = 'scheduled' announced = 'announced' draw_day = 'draw_day' drawn 
= 'drawn' finished = 'finished' class IconColor(models.TextChoices): red = 
'red' yellow = 'yellow' black = 'black' green = 'green' title = models.
CharField(max_length=500, default='PiA-Gewinnspiel', verbose_name='Titel') 
status = models.CharField(max_length=100, choices=GameStatus.choices, 
default=GameStatus.scheduled, verbose_name='Status', editable=False) 
announcement_date = models.DateField(verbose_name='Spiel ankündigen ab') 
draw_date = models.DateTimeField(verbose_name='Zeitpunkt der Auslosung') 
finished_date = models.DateField(verbose_name='Gewinner anzeigen bis') icon 
= models.CharField(max_length=100, default='park', verbose_name='Icon') 
icon_color = models.CharField(max_length=100, choices=IconColor.choices, 
default=IconColor.black, verbose_name='Icon Farbe') icon_outlined = models.
BooleanField(default=False, verbose_name='Icon outlined') class Meta: 
db_table = "RaffleGame" def __str__(self): return self.title

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/634c7481-842c-4eb7-b198-57c7d5bc3a66n%40googlegroups.com.


Re: Django Admin

2023-03-13 Thread Muhammad Juwaini Abdul Rahman
In my previous case, I only use this:

CSRF_TRUSTED_ORIGINS = ['https://your site url',]


On Tue, 14 Mar 2023 at 04:33, Prosper Lekia  wrote:

> This is how I deal with all csrf related issues.
>
> Make sure csrf MiddleWare is in your MiddleWare list
>
> 'django.middleware.csrf.CsrfViewMiddleware'
>
> Add the settings below in your settings.py to prevent all csrf related
> issues
>
> CSRF_TRUSTED_ORIGINS = ['https://your site url',]
> SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'http')
> CSRF_USE_SESSIONS = False
> CSRF_COOKIE_SECURE = True
> SECURE_BROWSER_XSS_FILTER = True
>
> CORS_ALLOW_CREDENTIALS = True
> CORS_ORIGIN_ALLOW_ALL = True
>
>
> SECURE_CONTENT_TYPE_NOSNIFF = True
> SECURE_FRAME_DENY = True
> SECURE_HSTS_SECONDS = 2592000
> SECURE_HSTS_INCLUDE_SUBDOMAINS = True
> SECURE_HSTS_PRELOAD = True
> X_FRAME_OPTIONS = 'SAMEORIGIN'
> SECURE_REFERRER_POLICY = 'same-origin
>
> On Saturday, March 11, 2023 at 7:04:40 PM UTC+1 James Hunt wrote:
>
>> Hi there. I am fairly new to Django but have had previous success with
>> creating an app and being able to access the Admin page.
>> Recently, if I attempt to access the admin page of a new Django app it
>> throws the CSRF error upon trying to log in!!!
>>
>> I have attempted several ways to bypass this error including adding
>> allowed hosts but I cant seem to get past this issue.
>>
>> Can someone please provide me with the definitive way of stopping CSRF
>> error when simply trying to access the admin part of Django? I mean there
>> are no post functions that really apply to this feature so I cant
>> understand the CSRF token.
>>
>> I cant get past this issue which means I can never access the admin page!!
>>
>> Please help.
>>
>> Regards
>>
>> James
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3f7e8ff3-3619-4ddf-8517-0ee3a613ed20n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFKhtoSMJcDx5bDfd3bXUsdt5a1x%2BFBaX%3D7KYk5H8wbCHvQT%2Bw%40mail.gmail.com.


Re: Django Admin

2023-03-13 Thread Prosper Lekia
This is how I deal with all csrf related issues.

Make sure csrf MiddleWare is in your MiddleWare list 

'django.middleware.csrf.CsrfViewMiddleware'

Add the settings below in your settings.py to prevent all csrf related 
issues

CSRF_TRUSTED_ORIGINS = ['https://your site url',]
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'http')
CSRF_USE_SESSIONS = False
CSRF_COOKIE_SECURE = True
SECURE_BROWSER_XSS_FILTER = True

CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = True


SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_FRAME_DENY = True
SECURE_HSTS_SECONDS = 2592000
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
X_FRAME_OPTIONS = 'SAMEORIGIN'
SECURE_REFERRER_POLICY = 'same-origin

On Saturday, March 11, 2023 at 7:04:40 PM UTC+1 James Hunt wrote:

> Hi there. I am fairly new to Django but have had previous success with 
> creating an app and being able to access the Admin page.
> Recently, if I attempt to access the admin page of a new Django app it 
> throws the CSRF error upon trying to log in!!!
>
> I have attempted several ways to bypass this error including adding 
> allowed hosts but I cant seem to get past this issue.
>
> Can someone please provide me with the definitive way of stopping CSRF 
> error when simply trying to access the admin part of Django? I mean there 
> are no post functions that really apply to this feature so I cant 
> understand the CSRF token.
>
> I cant get past this issue which means I can never access the admin page!!
>
> Please help.
>
> Regards
>
> James
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3f7e8ff3-3619-4ddf-8517-0ee3a613ed20n%40googlegroups.com.


Re: Django Admin

2023-03-13 Thread Starnford Chirwa
Howzt bro

On Sat, 11 Mar 2023, 22:48 Letlaka Tsotetsi,  wrote:

> Please share your code so we can be able to assist you
>
> On Sat, 11 Mar 2023 at 8:04 PM, James Hunt  wrote:
>
>> Hi there. I am fairly new to Django but have had previous success with
>> creating an app and being able to access the Admin page.
>> Recently, if I attempt to access the admin page of a new Django app it
>> throws the CSRF error upon trying to log in!!!
>>
>> I have attempted several ways to bypass this error including adding
>> allowed hosts but I cant seem to get past this issue.
>>
>> Can someone please provide me with the definitive way of stopping CSRF
>> error when simply trying to access the admin part of Django? I mean there
>> are no post functions that really apply to this feature so I cant
>> understand the CSRF token.
>>
>> I cant get past this issue which means I can never access the admin page!!
>>
>> Please help.
>>
>> Regards
>>
>> James
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com
>> 
>> .
>>
> --
> Letlaka Tsotetsi
> 071 038 1485
> letlak...@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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMCgpdJpk3b0c-7G__2-CtyP77%2BcJTmotqZ63dhuTnCNqNxAhg%40mail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFbY-hZMrcL1hjGQnXi3drkov_k9e7UR1WW1BYLRL3DAyb70Pw%40mail.gmail.com.


Re: Django Admin

2023-03-13 Thread Sandip Bhattacharya


> On Mar 13, 2023, at 5:14 AM, James Hunt  wrote:
> 
> I have yet to create a HTML page so I'm not sure that the inclusion of {% 
> csrf_token %} is required. I mean it's just the admin page I am trying to 
> access which is provided by Django and not a page created by me!!!
> 
> I am very surprised there is no fix for this issue!!! I might need to abandon 
> Django and move a different framework given that this issue is at the start 
> of a project!!!

There is clearly something else going on in your setup.

Here is a brand new Django project being created just now.

And the admin interface works without any issue.

https://gist.github.com/sandipb/cb9c9c6ba00603c30cf3a89d4141b2de

Can you check if you missed any steps?

Thanks,
  Sandip

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/AB3AE217-E571-4754-98EB-AF50C071A8B8%40showmethesource.org.


Re: Django Admin

2023-03-13 Thread Paul Kudla



ok hope i am not adding to the confusion

I ran into this a while back

CSRF errors are usually (in my case anyways) triggered by apache SSL 
setup etc


if you are running Apache + SSL you need to make sure the certificates 
and the SNI ssl naming is setup correctly or the CSRF errors will 
trigger randomly.


of course the ssl cert has to match the site name

this config assumes APACHE + WSGI + SSL etc. and you are running 
multiple virtual sites under apache.


Also note the port 80 redirect (ie everything is directed to the SSL site)

if you are mixing ssl & non-ssl apache / django will get confused and 
trip the CSRF error as well.


relative apache config (httpd.conf):


SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

SSLSessionCache memcache:localhost:11211  <<-- only if using memcache.



then my apache config for a site ?

admin.scom.ca ?


ServerName admin.scom.ca
ServerAlias admin.scom.ca
Redirect permanent / https://admin.scom.ca/



ServerName admin.scom.ca
ServerAlias admin.scom.ca
DocumentRoot /www/admin.scom.ca

Alias /media/ /www/admin.scom.ca/media/
Alias /static/ /www/admin.scom.ca/statics/
Alias /statics/ /www/admin.scom.ca/statics/


  Options FollowSymLinks
  AllowOverride None
  Require all granted


SSLEngine on
SSLProtocol all
SSLCertificateFile /www/admin.scom.ca/ssl/admin.scom.ca.crt
SSLCertificateKeyFile /www/admin.scom.ca/ssl/admin.scom.ca.key
SSLCertificateChainFile /www/admin.scom.ca/ssl/admin.scom.ca.chain



SuexecUserGroup www www

##Below only used if running WSGI##

WSGIDaemonProcess adminscomcassl user=www group=www processes=10 threads=20
WSGIProcessGroup adminscomcassl
WSGIApplicationGroup %{GLOBAL}
WSGIImportScript /www/admin.scom.ca/django.wsgi 
process-group=adminscomcassl application-group=%{GLOBAL}


WSGIScriptAlias / /www/admin.scom.ca/django.wsgi

##End of WSGI##


SecFilterEngine Off
SecFilterScanPOST Off




Order Deny,Allow
Deny from All




php_admin_value open_basedir /www/admin.scom.ca:/var/log/



php_admin_value sys_temp_dir /www/admin.scom.ca/tmp/



php_admin_value session.save_path /www/admin.scom.ca/tmp/



php_admin_value soap.wsdl_cache_dir /www/admin.scom.ca/tmp/



php_admin_value upload_tmp_dir /www/admin.scom.ca/tmp



AllowOverride All
php_value session.save_path "/www/admin.scom.ca/"










Happy Monday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services 
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 3/12/2023 5:44 AM, Muhammad Juwaini Abdul Rahman wrote:

I think you need to add the following in settings.py:

CSRF_TRUSTED_ORIGIN = ('')



On Sun, 12 Mar 2023 at 02:04, James Hunt > wrote:


Hi there. I am fairly new to Django but have had previous success
with creating an app and being able to access the Admin page.
Recently, if I attempt to access the admin page of a new Django app
it throws the CSRF error upon trying to log in!!!

I have attempted several ways to bypass this error including adding
allowed hosts but I cant seem to get past this issue.

Can someone please provide me with the definitive way of stopping
CSRF error when simply trying to access the admin part of Django? I
mean there are no post functions that really apply to this feature
so I cant understand the CSRF token.

I cant get past this issue which means I can never access the admin
page!!

Please help.

Regards

James

-- 
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 view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFKhtoRactd%2Bhg-3_m8d5MOKSYb0gp9J9m%2BjNM7naykJ8r3Kww%40mail.gmail.com .


--
This message has been scanned for viruses and
dangerous content by *MailScanner* , and is
believed to be clean.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group

Re: Django Admin

2023-03-13 Thread James Hunt
Hi there. I have yet to add a login/register page since I am only trying to 
access the admin page which is a part of the Django project setup. So in 
effect, there are no HTML pages setup and I cant access the Django admin 
page layout as this is an integral part of Django!!! This is the problem!! 

I'm not sure if anyone else who sets up a  Django project would need to 
create any HTML pages before they create a superuser login enabling them to 
access their admin section.

I cant resolve this issue!!

Cheers

J

On Monday, March 13, 2023 at 2:08:06 PM UTC Andrew Romany wrote:

> It's very simple you should add it in the login/register html page but 
> inside the  tag after &  to be specific after this 
> above line.
>
> On Mon, 13 Mar 2023, 11:15 a.m. James Hunt,  wrote:
>
>> I have yet to create a HTML page so I'm not sure that the inclusion of {% 
>> csrf_token %} is required. I mean it's just the admin page I am trying to 
>> access which is provided by Django and not a page created by me!!!
>>
>> I am very surprised there is no fix for this issue!!! I might need to 
>> abandon Django and move a different framework given that this issue is at 
>> the start of a project!!!
>>
>> Cheers
>>
>> Jay
>>
>> On Monday, March 13, 2023 at 3:06:42 AM UTC Mir Junaid wrote:
>>
>>> try including this line in your index.html or main HTML page 
>>> {% csrf_token %}
>>> if it still doesn't work do include it in every html page
>>>
>>> On Sat, 11 Mar 2023 at 23:33, James Hunt  wrote:
>>>
>>>> Hi there. I am fairly new to Django but have had previous success with 
>>>> creating an app and being able to access the Admin page.
>>>> Recently, if I attempt to access the admin page of a new Django app it 
>>>> throws the CSRF error upon trying to log in!!!
>>>>
>>>> I have attempted several ways to bypass this error including adding 
>>>> allowed hosts but I cant seem to get past this issue.
>>>>
>>>> Can someone please provide me with the definitive way of stopping CSRF 
>>>> error when simply trying to access the admin part of Django? I mean there 
>>>> are no post functions that really apply to this feature so I cant 
>>>> understand the CSRF token.
>>>>
>>>> I cant get past this issue which means I can never access the admin 
>>>> page!!
>>>>
>>>> Please help.
>>>>
>>>> Regards
>>>>
>>>> James
>>>>
>>>> -- 
>>>>
>>> You received this message because you are subscribed to the Google 
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to django-users...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/6f8d686c-3075-4aff-8227-c2f86e3cn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/6f8d686c-3075-4aff-8227-c2f86e3cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/447340ca-8977-4f28-9b1f-e2358c205914n%40googlegroups.com.


Re: Django Admin

2023-03-13 Thread Andrew Romany
It's very simple you should add it in the login/register html page but
inside the  tag after &  to be specific after this
above line.

On Mon, 13 Mar 2023, 11:15 a.m. James Hunt,  wrote:

> I have yet to create a HTML page so I'm not sure that the inclusion of {%
> csrf_token %} is required. I mean it's just the admin page I am trying to
> access which is provided by Django and not a page created by me!!!
>
> I am very surprised there is no fix for this issue!!! I might need to
> abandon Django and move a different framework given that this issue is at
> the start of a project!!!
>
> Cheers
>
> Jay
>
> On Monday, March 13, 2023 at 3:06:42 AM UTC Mir Junaid wrote:
>
>> try including this line in your index.html or main HTML page
>> {% csrf_token %}
>> if it still doesn't work do include it in every html page
>>
>> On Sat, 11 Mar 2023 at 23:33, James Hunt  wrote:
>>
>>> Hi there. I am fairly new to Django but have had previous success with
>>> creating an app and being able to access the Admin page.
>>> Recently, if I attempt to access the admin page of a new Django app it
>>> throws the CSRF error upon trying to log in!!!
>>>
>>> I have attempted several ways to bypass this error including adding
>>> allowed hosts but I cant seem to get past this issue.
>>>
>>> Can someone please provide me with the definitive way of stopping CSRF
>>> error when simply trying to access the admin part of Django? I mean there
>>> are no post functions that really apply to this feature so I cant
>>> understand the CSRF token.
>>>
>>> I cant get past this issue which means I can never access the admin
>>> page!!
>>>
>>> Please help.
>>>
>>> Regards
>>>
>>> James
>>>
>>> --
>>>
>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6f8d686c-3075-4aff-8227-c2f86e3cn%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGEtskruq9C4tg0BXDObB%2B7RORbKs8WXJcPOtTCO5Yw48fa1xA%40mail.gmail.com.


Re: Django Admin

2023-03-13 Thread James Hunt
I have yet to create a HTML page so I'm not sure that the inclusion of {% 
csrf_token %} is required. I mean it's just the admin page I am trying to 
access which is provided by Django and not a page created by me!!!

I am very surprised there is no fix for this issue!!! I might need to 
abandon Django and move a different framework given that this issue is at 
the start of a project!!!

Cheers

Jay

On Monday, March 13, 2023 at 3:06:42 AM UTC Mir Junaid wrote:

> try including this line in your index.html or main HTML page 
> {% csrf_token %}
> if it still doesn't work do include it in every html page
>
> On Sat, 11 Mar 2023 at 23:33, James Hunt  wrote:
>
>> Hi there. I am fairly new to Django but have had previous success with 
>> creating an app and being able to access the Admin page.
>> Recently, if I attempt to access the admin page of a new Django app it 
>> throws the CSRF error upon trying to log in!!!
>>
>> I have attempted several ways to bypass this error including adding 
>> allowed hosts but I cant seem to get past this issue.
>>
>> Can someone please provide me with the definitive way of stopping CSRF 
>> error when simply trying to access the admin part of Django? I mean there 
>> are no post functions that really apply to this feature so I cant 
>> understand the CSRF token.
>>
>> I cant get past this issue which means I can never access the admin page!!
>>
>> Please help.
>>
>> Regards
>>
>> James
>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6f8d686c-3075-4aff-8227-c2f86e3cn%40googlegroups.com.


Re: Django Admin

2023-03-12 Thread Mir Junaid
try including this line in your index.html or main HTML page
{% csrf_token %}
if it still doesn't work do include it in every html page

On Sat, 11 Mar 2023 at 23:33, James Hunt  wrote:

> Hi there. I am fairly new to Django but have had previous success with
> creating an app and being able to access the Admin page.
> Recently, if I attempt to access the admin page of a new Django app it
> throws the CSRF error upon trying to log in!!!
>
> I have attempted several ways to bypass this error including adding
> allowed hosts but I cant seem to get past this issue.
>
> Can someone please provide me with the definitive way of stopping CSRF
> error when simply trying to access the admin part of Django? I mean there
> are no post functions that really apply to this feature so I cant
> understand the CSRF token.
>
> I cant get past this issue which means I can never access the admin page!!
>
> Please help.
>
> Regards
>
> James
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAM%2BpT8ydCuKaQgPT6Uhao28Eyhx9R0XNhxEF-yVKEnCn0iGA3w%40mail.gmail.com.


Re: Django Admin

2023-03-12 Thread James Hunt
I did add this but no change!!! Just keep getting that CSRF token error 
when trying to access admin!! Which is strange as the CSRF token is 
predominantly for POST methods.

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

CSRF_TRUSTED_ORIGIN = (
'https://8000-famouswelsh-djangosetup-7vkpsqt0kez.ws-eu90.gitpod.io/')
# Application definition
On Sunday, March 12, 2023 at 12:57:19 PM UTC Muhammad Juwaini Abdul Rahman 
wrote:

> Have you tried my suggestion?
>
> On Sun, 12 Mar 2023 at 20:32, James Hunt  wrote:
>
>> I have literally set this up today just to prove that it happens for 
>> every Django project setup!!!
>>
>> So this is my settings :
>>
>>
>>  """
>> Django settings for DjangoTest project.
>>
>> Generated by 'django-admin startproject' using Django 4.1.7.
>>
>> For more information on this file, see
>> https://docs.djangoproject.com/en/4.1/topics/settings/
>>
>> For the full list of settings and their values, see
>> https://docs.djangoproject.com/en/4.1/ref/settings/
>> """
>>
>> from pathlib import Path
>>
>> # Build paths inside the project like this: BASE_DIR / 'subdir'.
>> BASE_DIR = Path(__file__).resolve().parent.parent
>>
>>
>> # Quick-start development settings - unsuitable for production
>> # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
>>
>> # SECURITY WARNING: keep the secret key used in production secret!
>> SECRET_KEY = 
>> 'django-insecure-zb-=l4$q!2t@wjwt!@cp#rz=16v0l)#uai#7h(u4n8eie@ddt%'
>>
>> # SECURITY WARNING: don't run with debug turned on in production!
>> DEBUG = True
>>
>> ALLOWED_HOSTS = []
>>
>>
>> # Application definition
>>
>> INSTALLED_APPS = [
>> 'django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> ]
>>
>> MIDDLEWARE = [
>> 'django.middleware.security.SecurityMiddleware',
>> 'django.contrib.sessions.middleware.SessionMiddleware',
>> 'django.middleware.common.CommonMiddleware',
>> 'django.middleware.csrf.CsrfViewMiddleware',
>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>> 'django.contrib.messages.middleware.MessageMiddleware',
>> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>> ]
>>
>> ROOT_URLCONF = 'DjangoTest.urls'
>>
>> TEMPLATES = [
>> {
>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>> 'DIRS': [],
>> 'APP_DIRS': True,
>> 'OPTIONS': {
>> 'context_processors': [
>> 'django.template.context_processors.debug',
>> 'django.template.context_processors.request',
>> 'django.contrib.auth.context_processors.auth',
>> 'django.contrib.messages.context_processors.messages',
>> ],
>> },
>> },
>> ]
>>
>> WSGI_APPLICATION = 'DjangoTest.wsgi.application'
>>
>>
>> # Database
>> # https://docs.djangoproject.com/en/4.1/ref/settings/#databases
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.sqlite3',
>> 'NAME': BASE_DIR / 'db.sqlite3',
>> }
>> }
>>
>>
>> # Password validation
>> # 
>> https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
>>
>> AUTH_PASSWORD_VALIDATORS = [
>> {
>> 'NAME': 
>> 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
>> ,
>> },
>> {
>> 'NAME': 
>> 'django.contrib.auth.password_validation.MinimumLengthValidator',
>> },
>> {
>> 'NAME': 
>> 'django.contrib.auth.password_validation.CommonPasswordValidator',
>> },
>> {
>> 'NAME': 
>> 'django.contrib.auth.password_validation.NumericPasswordValidator',
>> },
>> ]
>>
>>
>> # Interna

Re: Django Admin

2023-03-12 Thread Muhammad Juwaini Abdul Rahman
Have you tried my suggestion?

On Sun, 12 Mar 2023 at 20:32, James Hunt  wrote:

> I have literally set this up today just to prove that it happens for every
> Django project setup!!!
>
> So this is my settings :
>
>
>  """
> Django settings for DjangoTest project.
>
> Generated by 'django-admin startproject' using Django 4.1.7.
>
> For more information on this file, see
> https://docs.djangoproject.com/en/4.1/topics/settings/
>
> For the full list of settings and their values, see
> https://docs.djangoproject.com/en/4.1/ref/settings/
> """
>
> from pathlib import Path
>
> # Build paths inside the project like this: BASE_DIR / 'subdir'.
> BASE_DIR = Path(__file__).resolve().parent.parent
>
>
> # Quick-start development settings - unsuitable for production
> # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
>
> # SECURITY WARNING: keep the secret key used in production secret!
> SECRET_KEY = 'django-insecure-zb-=l4$q!2t@wjwt
> !@cp#rz=16v0l)#uai#7h(u4n8eie@ddt%'
>
> # SECURITY WARNING: don't run with debug turned on in production!
> DEBUG = True
>
> ALLOWED_HOSTS = []
>
>
> # Application definition
>
> INSTALLED_APPS = [
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> ]
>
> MIDDLEWARE = [
> 'django.middleware.security.SecurityMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> ]
>
> ROOT_URLCONF = 'DjangoTest.urls'
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [],
> 'APP_DIRS': True,
> 'OPTIONS': {
> 'context_processors': [
> 'django.template.context_processors.debug',
> 'django.template.context_processors.request',
> 'django.contrib.auth.context_processors.auth',
> 'django.contrib.messages.context_processors.messages',
> ],
> },
> },
> ]
>
> WSGI_APPLICATION = 'DjangoTest.wsgi.application'
>
>
> # Database
> # https://docs.djangoproject.com/en/4.1/ref/settings/#databases
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3',
> 'NAME': BASE_DIR / 'db.sqlite3',
> }
> }
>
>
> # Password validation
> #
> https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
>
> AUTH_PASSWORD_VALIDATORS = [
> {
> 'NAME':
> 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
> ,
> },
> {
> 'NAME':
> 'django.contrib.auth.password_validation.MinimumLengthValidator',
> },
> {
> 'NAME':
> 'django.contrib.auth.password_validation.CommonPasswordValidator',
> },
> {
> 'NAME':
> 'django.contrib.auth.password_validation.NumericPasswordValidator',
> },
> ]
>
>
> # Internationalization
> # https://docs.djangoproject.com/en/4.1/topics/i18n/
>
> LANGUAGE_CODE = 'en-us'
>
> TIME_ZONE = 'UTC'
>
> USE_I18N = True
>
> USE_TZ = True
>
>
> # Static files (CSS, JavaScript, Images)
> # https://docs.djangoproject.com/en/4.1/howto/static-files/
>
> STATIC_URL = 'static/'
>
> # Default primary key field type
> # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
>
> DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
>
>
> On Sunday, March 12, 2023 at 9:46:04 AM UTC Muhammad Juwaini Abdul Rahman
> wrote:
>
>> I think you need to add the following in settings.py:
>>
>> CSRF_TRUSTED_ORIGIN = ('')
>>
>>
>>
>> On Sun, 12 Mar 2023 at 02:04, James Hunt  wrote:
>>
>>> Hi there. I am fairly new to Django but have had previous success with
>>> creating 

Re: Django Admin

2023-03-12 Thread James Hunt
I have literally set this up today just to prove that it happens for every 
Django project setup!!!

So this is my settings :


 """
Django settings for DjangoTest project.

Generated by 'django-admin startproject' using Django 4.1.7.

For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 
'django-insecure-zb-=l4$q!2t@wjwt!@cp#rz=16v0l)#uai#7h(u4n8eie@ddt%'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'DjangoTest.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'DjangoTest.wsgi.application'


# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}


# Password validation
# 
https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 
'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/4.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'


On Sunday, March 12, 2023 at 9:46:04 AM UTC Muhammad Juwaini Abdul Rahman 
wrote:

> I think you need to add the following in settings.py:
>
> CSRF_TRUSTED_ORIGIN = ('')
>
>
>
> On Sun, 12 Mar 2023 at 02:04, James Hunt  wrote:
>
>> Hi there. I am fairly new to Django but have had previous success with 
>> creating an app and being able to access the Admin page.
>> Recently, if I attempt to access the admin page of a new Django app it 
>> throws the CSRF error upon trying to log in!!!
>>
>> I have attempted several ways to bypass this error including adding 
>> allowed hosts but I cant seem to get past this issue.
>>
>> Can someone please provide me with the definitive way of stopping CSRF 
>> error when simply trying to access the admin part of Django? I mean there 
>> are no post functions that really apply to this feature so I cant 
>> understand the CSRF token.
>>
>> I cant get past this issue which means I can never access the admin page!!
>>
>> Please help.
>>
>> Regards
>&g

Re: Django Admin

2023-03-12 Thread Muhammad Juwaini Abdul Rahman
I think you need to add the following in settings.py:

CSRF_TRUSTED_ORIGIN = ('')



On Sun, 12 Mar 2023 at 02:04, James Hunt  wrote:

> Hi there. I am fairly new to Django but have had previous success with
> creating an app and being able to access the Admin page.
> Recently, if I attempt to access the admin page of a new Django app it
> throws the CSRF error upon trying to log in!!!
>
> I have attempted several ways to bypass this error including adding
> allowed hosts but I cant seem to get past this issue.
>
> Can someone please provide me with the definitive way of stopping CSRF
> error when simply trying to access the admin part of Django? I mean there
> are no post functions that really apply to this feature so I cant
> understand the CSRF token.
>
> I cant get past this issue which means I can never access the admin page!!
>
> Please help.
>
> Regards
>
> James
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFKhtoRactd%2Bhg-3_m8d5MOKSYb0gp9J9m%2BjNM7naykJ8r3Kww%40mail.gmail.com.


Re: Django Admin

2023-03-11 Thread Letlaka Tsotetsi
Please share your code so we can be able to assist you

On Sat, 11 Mar 2023 at 8:04 PM, James Hunt  wrote:

> Hi there. I am fairly new to Django but have had previous success with
> creating an app and being able to access the Admin page.
> Recently, if I attempt to access the admin page of a new Django app it
> throws the CSRF error upon trying to log in!!!
>
> I have attempted several ways to bypass this error including adding
> allowed hosts but I cant seem to get past this issue.
>
> Can someone please provide me with the definitive way of stopping CSRF
> error when simply trying to access the admin part of Django? I mean there
> are no post functions that really apply to this feature so I cant
> understand the CSRF token.
>
> I cant get past this issue which means I can never access the admin page!!
>
> Please help.
>
> Regards
>
> James
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com
> 
> .
>
-- 
Letlaka Tsotetsi
071 038 1485
letlak...@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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMCgpdJpk3b0c-7G__2-CtyP77%2BcJTmotqZ63dhuTnCNqNxAhg%40mail.gmail.com.


Re: Django Admin

2023-03-11 Thread Victor Matthew
Show your cold pleased


On Sat, 11 Mar 2023, 7:04 pm James Hunt,  wrote:

> Hi there. I am fairly new to Django but have had previous success with
> creating an app and being able to access the Admin page.
> Recently, if I attempt to access the admin page of a new Django app it
> throws the CSRF error upon trying to log in!!!
>
> I have attempted several ways to bypass this error including adding
> allowed hosts but I cant seem to get past this issue.
>
> Can someone please provide me with the definitive way of stopping CSRF
> error when simply trying to access the admin part of Django? I mean there
> are no post functions that really apply to this feature so I cant
> understand the CSRF token.
>
> I cant get past this issue which means I can never access the admin page!!
>
> Please help.
>
> Regards
>
> James
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJSJbPbY%3DWz%2BU%3DMJWFgyezCVgKSqy_28hBtvdUAhLcS%2BaxaYUw%40mail.gmail.com.


Re: Django Admin

2023-03-11 Thread Obam Olohu
Hello there, you can send a meeting link, I’ll fix the issue for you 

Sent from my iPhone

> On 11 Mar 2023, at 12:31 PM, James Hunt  wrote:
> 
> Hi there. I am fairly new to Django but have had previous success with 
> creating an app and being able to access the Admin page.
> Recently, if I attempt to access the admin page of a new Django app it throws 
> the CSRF error upon trying to log in!!!
> 
> I have attempted several ways to bypass this error including adding allowed 
> hosts but I cant seem to get past this issue.
> 
> Can someone please provide me with the definitive way of stopping CSRF error 
> when simply trying to access the admin part of Django? I mean there are no 
> post functions that really apply to this feature so I cant understand the 
> CSRF token.
> 
> I cant get past this issue which means I can never access the admin page!!
> 
> Please help.
> 
> Regards
> 
> James
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/94495E83-3D75-4905-96B8-12DEA527DFE0%40gmail.com.


Re: Django Admin

2023-03-11 Thread Balogun Awwal
Check out this link but are you using csrf token before accepting any input.  
https://stackoverflow.com/questions/3197321/csrf-error-in-django

Sent from awwal

> On 11 Mar 2023, at 7:04 PM, James Hunt  wrote:
> 
> Hi there. I am fairly new to Django but have had previous success with 
> creating an app and being able to access the Admin page.
> Recently, if I attempt to access the admin page of a new Django app it throws 
> the CSRF error upon trying to log in!!!
> 
> I have attempted several ways to bypass this error including adding allowed 
> hosts but I cant seem to get past this issue.
> 
> Can someone please provide me with the definitive way of stopping CSRF error 
> when simply trying to access the admin part of Django? I mean there are no 
> post functions that really apply to this feature so I cant understand the 
> CSRF token.
> 
> I cant get past this issue which means I can never access the admin page!!
> 
> Please help.
> 
> Regards
> 
> James
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25574CBA-771F-41FB-8EDD-7C17273C5CF8%40gmail.com.


Django Admin

2023-03-11 Thread James Hunt
Hi there. I am fairly new to Django but have had previous success with 
creating an app and being able to access the Admin page.
Recently, if I attempt to access the admin page of a new Django app it 
throws the CSRF error upon trying to log in!!!

I have attempted several ways to bypass this error including adding allowed 
hosts but I cant seem to get past this issue.

Can someone please provide me with the definitive way of stopping CSRF 
error when simply trying to access the admin part of Django? I mean there 
are no post functions that really apply to this feature so I cant 
understand the CSRF token.

I cant get past this issue which means I can never access the admin page!!

Please help.

Regards

James

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com.


Django admin only one group per user

2023-02-15 Thread Joao Frankmann
I am creating a customised Django Admin and I want to restrict users to be 
associated to no more than one group. I am using Django 4.1 and Python 3.11

admin.py:

```
from django.contrib import admin
from typing import Set

from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
from django.utils.translation import gettext_lazy as _

from .models import User


@admin.register(User)
class UserAdmin(DjangoUserAdmin):
ordering = ('is_staff', 'is_active', 'email', 'organisation')
list_display = ('email', 'name', 'organisation', 'is_staff', 
'is_active', 'is_superuser', 'date_joined')
fieldsets = (
("Personal info", {'fields': ('name', 'email', 'password', 
'organisation')}),
("Permissions", {'fields': (
# 'is_active',
# 'is_staff',
# 'is_superuser',
'groups',
# 'user_permissions'
)}))

add_fieldsets = (
(None, {'classes': ('wide',), 'fields': ('name', 'email', 
'password1', 'password2', 'organisation')}),
)
```

Is there a way to change this in the admin code?

Or it is possible to disable the group widget ("Choose all") on the page? 
if so which html page is used for groups?
https://i.stack.imgur.com/MyAD7.png

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/789f77e0-60e6-4664-a734-28e37e795138n%40googlegroups.com.


Re: DJANGO ADMIN SPECIFICATION

2022-09-11 Thread chahat kaur
Yes

On Sun, Sep 11, 2022, 00:48 Dushime Mudahera Richard 
wrote:

> yeah  All u said can be done in short """CRUD""""
>
>
> *Best Regards *
> *Dushime Mudahera Richard*
> *Google Crowdsource Influencer*
> *GDSC Lead 2021-2022 Bugema University*
> *Visit :* https://www.facebook.com/BSA256
> *Visit me *: Community Learning MS
> <http://communitylearning.great-site.net/>
> Web dev and  IT Manager @Bluebird Soccer Academy
> Kyangwali Refugee Settlement  Office
> richdus...@gmail.com | richarddush...@bluebirdsocceracademy.org
> *Website *: www.bluebirdsocceracademy.org
> Sports | Mentorship | Leadership | Girl Child Empowerment
>
>
> On Sat, Sep 10, 2022 at 7:21 PM nana kwame  wrote:
>
>> Please I would like to ask if Django admin can be used to update and
>> delete and create webpages also. And also if it can be used to update
>> information on the user side from the admin panel. 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3fe4e1e6-a313-460b-aef2-77b4d76da9d5n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/3fe4e1e6-a313-460b-aef2-77b4d76da9d5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJCm56JprYrbt9Um6HRVX%3DDVYpyjTyqBNEqTFu%3DP%3DPX3DSChYQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJCm56JprYrbt9Um6HRVX%3DDVYpyjTyqBNEqTFu%3DP%3DPX3DSChYQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN-96%3DK4Bt2Ui0iYvUVit3vp3e%3Dp-AC4JYSSdTe6BCzuHo%3DGgw%40mail.gmail.com.


Re: DJANGO ADMIN SPECIFICATION

2022-09-10 Thread Dushime Mudahera Richard
yeah  All u said can be done in short """CRUD""""


*Best Regards *
*Dushime Mudahera Richard*
*Google Crowdsource Influencer*
*GDSC Lead 2021-2022 Bugema University*
*Visit :* https://www.facebook.com/BSA256
*Visit me *: Community Learning MS
<http://communitylearning.great-site.net/>
Web dev and  IT Manager @Bluebird Soccer Academy
Kyangwali Refugee Settlement  Office
richdus...@gmail.com | richarddush...@bluebirdsocceracademy.org
*Website *: www.bluebirdsocceracademy.org
Sports | Mentorship | Leadership | Girl Child Empowerment


On Sat, Sep 10, 2022 at 7:21 PM nana kwame  wrote:

> Please I would like to ask if Django admin can be used to update and
> delete and create webpages also. And also if it can be used to update
> information on the user side from the admin panel. 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3fe4e1e6-a313-460b-aef2-77b4d76da9d5n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/3fe4e1e6-a313-460b-aef2-77b4d76da9d5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJCm56JprYrbt9Um6HRVX%3DDVYpyjTyqBNEqTFu%3DP%3DPX3DSChYQ%40mail.gmail.com.


Re: DJANGO ADMIN SPECIFICATION

2022-09-10 Thread 'Kasper Laudrup' via Django users

On 10/09/2022 03.24, nana kwame wrote:
Please I would like to ask if Django admin can be used to update and 
delete and create webpages also.


If you write the appropriate models and views then yes, it can.

And also if it can be used to update 
information on the user side from the admin panel. Thank You




Yes.

Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a64c3d13-bd64-6c3a-07de-a50c16d3f51c%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


DJANGO ADMIN SPECIFICATION

2022-09-10 Thread nana kwame
Please I would like to ask if Django admin can be used to update and delete 
and create webpages also. And also if it can be used to update information 
on the user side from the admin panel. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3fe4e1e6-a313-460b-aef2-77b4d76da9d5n%40googlegroups.com.


Django-Admin : OveOrride add-URL of the Foreign Key Auto-Complete "add" button / + green cross

2022-09-08 Thread luigim...@gmail.com
Hello Community, 

*Goal* : adding a parameter to the add_url embedded by the green cross of a 
foreignkey field in the django-admin details view.


[image: Screenshot 2022-09-08 at 12.00.39.png]

*Solution* : pass my parameter as a widget attrs through the 
*formfield_for_dbfield* method and override the admin template : see code 
paste_bin <https://pastebin.com/gTE6ahwh>

*Issue* : 
- Template gets overriden
- I can't access attrs.my_parameter or attr.my_parameter. It remains empty. 

Am I doing something wrong? Is it a bug ? 


Best, 

Louis

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/889e1ca0-7355-44b8-9ced-cf80897f0476n%40googlegroups.com.


Forbidden error- login to django admin

2022-09-02 Thread Amal Babu
I try to deploy my django project on railway. But i got this error[image: 
Screenshot 2022-09-02 102845.png]

my prod settings -->


import os
from .common import *

DEBUG = False

SECRET_KEY = os.environ.get('SECRET_KEY')

ALLOWED_HOSTS = ['web-production-b9a0.up.railway.app',
 'containers-us-west-62.railway.app']




DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ.get('PGDATABASE'),
'USER': os.environ.get('PGUSER'),
'PASSWORD': os.environ.get('PGPASSWORD'),
'HOST': os.environ.get('PGHOST'),
'PORT': os.environ.get('PGPORT')
},
}

main settings is



from datetime import timedelta
import os
from datetime import timedelta
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent



# Application definition

INSTALLED_APPS = [
'jazzmin',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'django_filters',
'djoser',
'rest_framework_simplejwt.token_blacklist',
'corsheaders',
 
]

MIDDLEWARE = [
"corsheaders.middleware.CorsMiddleware",
'django.middleware.security.SecurityMiddleware',
"whitenoise.middleware.WhiteNoiseMiddleware",
'silk.middleware.SilkyMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]


INTERNAL_IPS = [
# ...
'127.0.0.1',
# ...
]

CSRF_TRUSTED_ORIGINS = ['http://*.railway.app',
'https://web-production-b9a0.up.railway.app/']


ROOT_URLCONF = 'storefront.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'storefront.wsgi.application'


# Password validation
# 
https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 
'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True



STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')


DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

REST_FRAMEWORK = {
'COERCE_DECIMAL_TO_STRING': False,
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication',
),
}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/33075c91-b177-4568-b326-bc824b339b6en%40googlegroups.com.


Re: django-admin startproject --template error

2022-08-08 Thread 'Kasper Laudrup' via Django users

On 08/08/2022 10.46, xu brandy wrote:


WechatIMG75.png
An error was reported using the GITLab repository to specify template 
creation projects




And you expect everyone to be able to guess which Gitlab repository 
you're talking about? You even made an effort trying to hide it.


But whatever repository you're fetching the zip file from doesn't 
contain a valid zip file as the error message clearly states.


Only you know why that might be with the information you've shared so far.

Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1d1b090d-d394-5d61-1c41-393a109c9e39%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Code produced by "django-admin startproject" isn't formatted by black

2022-06-23 Thread Paweł Adamczak
Hi!

I just run "django-admin startproject" command on the latest Django version 
(4.0.5) and noticed that the code it generated isn't formatted by black, 
even though #33476 <https://code.djangoproject.com/ticket/33476> explicitly 
mentions that it should.

I wasn't sure if I should open another bug or comment on the one above, so 
I decided to write here first.

I'm happy to contribute via a PR.

All best,
Paweł

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/34735176-9060-4685-b259-ff621473231dn%40googlegroups.com.


Re: django-admin-honeypot

2022-05-16 Thread Jeremy Lainé
A number of translation methods were deprecated in Django 3.0 (including 
ugettext_lazy) and remove in Django 4.0:

https://docs.djangoproject.com/en/dev/releases/3.0/#deprecated-features-3-0
https://docs.djangoproject.com/en/dev/internals/deprecation/#deprecation-removed-in-4-0

The bottom line is that django-admin-honeypot needs to be updated to work 
with recent Django versions, see:

https://github.com/dmpayton/django-admin-honeypot/issues/87

Cheers,
Jeremy
On Tuesday, May 10, 2022 at 7:48:38 AM UTC+2 chsuresh...@gmail.com wrote:

> Hi ,
> While i am including the django-admin-honeypot , i am getting this error , 
> i followed the procedure in the documentation but not working
>
> [image: image.png]
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f4006ce1-17b2-40b6-8ab0-e80ef9500057n%40googlegroups.com.


Django Admin external script before save/delete

2022-05-10 Thread Thiago Luiz Parolin
Hello everyone,
I'm trying to run a script before saving and deleting objects in db
using django admin.
If the script fails, the action (save or delete) needs to be aborted
and we need to inform the user with a message.

In the django docs:

"...When overriding ModelAdmin.save_model()
andModelAdmin.delete_model(), your code should save/delete the object.
They are not for veto purposes, but allow you to perform extra operations..."

So using modelform I can make this work for save, but how can I make
it for delete (or delete_queryset) too?

Thanks!

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANbmKyu9HOckLtb%3DRX%3DfWJM6K3ccmYn%2BUsSjynv5zFATisQsww%40mail.gmail.com.


Re: Possible Django Admin or auth bug or Mozilla bug

2022-04-14 Thread Mike Dewhirst
AntonisRight. I got the  tag to appear in the right place but I think 
the js itself is not being effective. I guess since there is an existing bug 
report I'll just have live with it until magic happens.Thanks for jumping 
in.CheersMike --(Unsigned mail from my phone)
 Original message From: Antonis Christofides 
<anto...@antonischristofides.com> Date: 15/4/22  01:26  (GMT+10:00) To: 
django-users <django-users@googlegroups.com> Subject: Re: Possible Django Admin 
or auth bug or Mozilla bug 
I haven't tried it, but I have a few observations on your
  template code. First, it would be better to use "{% static %}"
  instead of hardcoding the url to the static files. Second, "{%
  blcok extrastyle %}" is obviously wrong for this, it should be
  extrajs. However, neither of these should affect what you are
  trying to accomplish (except if extrastyle comes earlier than
  extrajs).



On 14/04/2022 06.37, Mike Dewhirst
  wrote:


  
  On 14/04/2022 11:36 am, Mike Dewhirst
wrote:
  
  

Thanks Antonis
  
  OK - the problem has two workarounds. One is to use Chrome.
  
  Two is <a  rel="nofollow" href="https://code.djangoproject.com/ticket/33386">https://code.djangoproject.com/ticket/33386</a>
  which suggests including some javascript to disable Firefox
  autocomplete ...
  
  $('form').attr('autocomplete', 'off').each(function () {
this.reset();
});

  
  
  Can anyone verify that the above javascript will work?
  
  And I cannot because I don't know how to javascript. This is what
  I tried ...
  
  <project>/static/admin/js/autocomplete_off.js
  
  $('form').attr('autocomplete', 'off').each(function () {
      this.reset();
  });
  
  <project>/templates/admin/auth/group/change_form.html
  
  {% extends "admin/change_form.html" %}
  {% load i18n admin_urls static admin_modify %}
  {% block extrastyle %}{{ block.super }}
  <script
  src="/static/admin/js/autocomplete_off.js">
  {% endblock %}
  
  Thanks
  
  Mike
  
  
  
 
  ... but this looks a bit like a sledgehammer. What might that
  do to other browsers?
  
  I guess I'll give that a try and see what happens.
  
  Cheers
  
  Mike
  
  
  On 13/04/2022 11:19 pm, Antonis Christofides wrote:


  
  It happens here as well as far as I can see (tested on a
Debian 11 server running Django 3.2.12).
  The "Chosen groups" box seems to be created by JavaScript;
if I run it with JavaScript disabled then it doesn't exist.
Apparently JavaScript creates the box and then populates it
and accordingly removes stuff from "Available groups".
Therefore it could be an error in Django; maybe for some
reason that JavaScript doesn't always run correctly on
Firefox.
  If I were you I'd file a Django bug anyway.
  
  Regards,
  Antonis
  
  
  
  
  
  On 13/04/2022 10.00, Mike
Dewhirst wrote:
  
  I
don't know how long this has been happening for me. 

Happens on Windows 10 in Mozilla Firefox but not Chrome. 

 In the Admin User screen where there are two boxes of
Groups labelled 'Available groups' and 'Chosen groups' with
controls to move groups between boxes, everything seems to
work perfectly - until I refresh the screen! 

On refresh, the Chosen groups box seems to slide across to
the left and drop all its groups into the Available box! It
quickly resumes its usual place on the right except that it
is completely empty. 

Shift refresh retrieves the data from the database and
everything is OK. 

The problem is that if an admin user accidentally saves
after a refresh, they save that profile with no permissions
and that user loses all access to their data. 

I have tested identically on four different Django projects
I look after with the same results. Django versions 3.2.12
and 3.2.13 running on Apache 2.4 on Ubuntu 20.04 and
localhost on Windows 10 with the dev server. Also happens on
Ubuntu 18.04 with ng

Re: Possible Django Admin or auth bug or Mozilla bug

2022-04-14 Thread Antonis Christofides

  
  
I haven't tried it, but I have a few observations on your
  template code. First, it would be better to use "{% static %}"
  instead of hardcoding the url to the static files. Second, "{%
  blcok extrastyle %}" is obviously wrong for this, it should be
  extrajs. However, neither of these should affect what you are
  trying to accomplish (except if extrastyle comes earlier than
  extrajs).



On 14/04/2022 06.37, Mike Dewhirst
  wrote:


  
  On 14/04/2022 11:36 am, Mike Dewhirst
wrote:
  
  

Thanks Antonis
  
  OK - the problem has two workarounds. One is to use Chrome.
  
  Two is https://code.djangoproject.com/ticket/33386
  which suggests including some _javascript_ to disable Firefox
  autocomplete ...
  
  $('form').attr('autocomplete', 'off').each(function () {
this.reset();
});

  
  
  Can anyone verify that the above _javascript_ will work?
  
  And I cannot because I don't know how to _javascript_. This is what
  I tried ...
  
  /static/admin/js/autocomplete_off.js
  
  $('form').attr('autocomplete', 'off').each(function () {
      this.reset();
  });
  
  /templates/admin/auth/group/change_form.html
  
  {% extends "admin/change_form.html" %}
  {% load i18n admin_urls static admin_modify %}
  {% block extrastyle %}{{ block.super }}
  
  {% endblock %}
  
  Thanks
  
  Mike
  
  
  
 
  ... but this looks a bit like a sledgehammer. What might that
  do to other browsers?
  
  I guess I'll give that a try and see what happens.
  
  Cheers
  
  Mike
  
  
  On 13/04/2022 11:19 pm, Antonis Christofides wrote:


  
  It happens here as well as far as I can see (tested on a
Debian 11 server running Django 3.2.12).
  The "Chosen groups" box seems to be created by _javascript_;
if I run it with _javascript_ disabled then it doesn't exist.
Apparently _javascript_ creates the box and then populates it
and accordingly removes stuff from "Available groups".
Therefore it could be an error in Django; maybe for some
reason that _javascript_ doesn't always run correctly on
Firefox.
  If I were you I'd file a Django bug anyway.
  
  Regards,
  Antonis
  
  
  
  
  
  On 13/04/2022 10.00, Mike
Dewhirst wrote:
  
  I
don't know how long this has been happening for me. 

Happens on Windows 10 in Mozilla Firefox but not Chrome. 

 In the Admin User screen where there are two boxes of
Groups labelled 'Available groups' and 'Chosen groups' with
controls to move groups between boxes, everything seems to
work perfectly - until I refresh the screen! 

On refresh, the Chosen groups box seems to slide across to
the left and drop all its groups into the Available box! It
quickly resumes its usual place on the right except that it
is completely empty. 

Shift refresh retrieves the data from the database and
everything is OK. 

The problem is that if an admin user accidentally saves
after a refresh, they save that profile with no permissions
and that user loses all access to their data. 

I have tested identically on four different Django projects
I look after with the same results. Django versions 3.2.12
and 3.2.13 running on Apache 2.4 on Ubuntu 20.04 and
localhost on Windows 10 with the dev server. Also happens on
Ubuntu 18.04 with nginx and running Mezzanine. 

Any ideas? Debug strategy? 

Not sure where to start. 

Seems like a Mozilla issue but I have been known to get
things wrong. Has anyone seen this? 

Thanks 

Mike 


  
  -- 
  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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/92661660-a500-f625-ac9a-d1404f99cb3d%40antonischristofides.com.



-- 
Signed email is an absolute defence against p

Re: Possible Django Admin or auth bug or Mozilla bug

2022-04-13 Thread Mike Dewhirst

On 14/04/2022 11:36 am, Mike Dewhirst wrote:

Thanks Antonis

OK - the problem has two workarounds. One is to use Chrome.

Two is https://code.djangoproject.com/ticket/33386 which suggests 
including some javascript to disable Firefox autocomplete ...


$('form').attr('autocomplete', 'off').each(function () {
 this.reset();
});


Can anyone verify that the above javascript will work?

And I cannot because I don't know how to javascript. This is what I 
tried ...


/static/admin/js/autocomplete_off.js

$('form').attr('autocomplete', 'off').each(function () {
    this.reset();
});

/templates/admin/auth/group/change_form.html

{% extends "admin/change_form.html" %}
{% load i18n admin_urls static admin_modify %}
{% block extrastyle %}{{ block.super }}

{% endblock %}

Thanks

Mike




... but this looks a bit like a sledgehammer. What might that do to 
other browsers?


I guess I'll give that a try and see what happens.

Cheers

Mike


On 13/04/2022 11:19 pm, Antonis Christofides wrote:


It happens here as well as far as I can see (tested on a Debian 11 
server running Django 3.2.12).


The "Chosen groups" box seems to be created by JavaScript; if I run 
it with JavaScript disabled then it doesn't exist. Apparently 
JavaScript creates the box and then populates it and accordingly 
removes stuff from "Available groups". Therefore it could be an error 
in Django; maybe for some reason that JavaScript doesn't always run 
correctly on Firefox.


If I were you I'd file a Django bug anyway.

Regards,

Antonis



On 13/04/2022 10.00, Mike Dewhirst wrote:

I don't know how long this has been happening for me.

Happens on Windows 10 in Mozilla Firefox but not Chrome.

 In the Admin User screen where there are two boxes of Groups 
labelled 'Available groups' and 'Chosen groups' with controls to 
move groups between boxes, everything seems to work perfectly - 
until I refresh the screen!


On refresh, the Chosen groups box seems to slide across to the left 
and drop all its groups into the Available box! It quickly resumes 
its usual place on the right except that it is completely empty.


Shift refresh retrieves the data from the database and everything is 
OK.


The problem is that if an admin user accidentally saves after a 
refresh, they save that profile with no permissions and that user 
loses all access to their data.


I have tested identically on four different Django projects I look 
after with the same results. Django versions 3.2.12 and 3.2.13 
running on Apache 2.4 on Ubuntu 20.04 and localhost on Windows 10 
with the dev server. Also happens on Ubuntu 18.04 with nginx and 
running Mezzanine.


Any ideas? Debug strategy?

Not sure where to start.

Seems like a Mozilla issue but I have been known to get things 
wrong. Has anyone seen this?


Thanks

Mike



--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92661660-a500-f625-ac9a-d1404f99cb3d%40antonischristofides.com 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.
--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9eebd918-dbef-dbcd-94fd-ea841b7f6969%40dewhirst.com.au 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c89c0030-5750-729d-1c63-e787726b99e0%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Possible Django Admin or auth bug or Mozilla bug

2022-04-13 Thread Mike Dewhirst

Thanks Antonis

OK - the problem has two workarounds. One is to use Chrome.

Two is https://code.djangoproject.com/ticket/33386 which suggests 
including some javascript to disable Firefox autocomplete ...


$('form').attr('autocomplete', 'off').each(function () {
this.reset();
});


... but this looks a bit like a sledgehammer. What might that do to 
other browsers?


I guess I'll give that a try and see what happens.

Cheers

Mike


On 13/04/2022 11:19 pm, Antonis Christofides wrote:


It happens here as well as far as I can see (tested on a Debian 11 
server running Django 3.2.12).


The "Chosen groups" box seems to be created by JavaScript; if I run it 
with JavaScript disabled then it doesn't exist. Apparently JavaScript 
creates the box and then populates it and accordingly removes stuff 
from "Available groups". Therefore it could be an error in Django; 
maybe for some reason that JavaScript doesn't always run correctly on 
Firefox.


If I were you I'd file a Django bug anyway.

Regards,

Antonis



On 13/04/2022 10.00, Mike Dewhirst wrote:

I don't know how long this has been happening for me.

Happens on Windows 10 in Mozilla Firefox but not Chrome.

 In the Admin User screen where there are two boxes of Groups 
labelled 'Available groups' and 'Chosen groups' with controls to move 
groups between boxes, everything seems to work perfectly - until I 
refresh the screen!


On refresh, the Chosen groups box seems to slide across to the left 
and drop all its groups into the Available box! It quickly resumes 
its usual place on the right except that it is completely empty.


Shift refresh retrieves the data from the database and everything is OK.

The problem is that if an admin user accidentally saves after a 
refresh, they save that profile with no permissions and that user 
loses all access to their data.


I have tested identically on four different Django projects I look 
after with the same results. Django versions 3.2.12 and 3.2.13 
running on Apache 2.4 on Ubuntu 20.04 and localhost on Windows 10 
with the dev server. Also happens on Ubuntu 18.04 with nginx and 
running Mezzanine.


Any ideas? Debug strategy?

Not sure where to start.

Seems like a Mozilla issue but I have been known to get things wrong. 
Has anyone seen this?


Thanks

Mike



--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92661660-a500-f625-ac9a-d1404f99cb3d%40antonischristofides.com 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9eebd918-dbef-dbcd-94fd-ea841b7f6969%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Possible Django Admin or auth bug or Mozilla bug

2022-04-13 Thread Antonis Christofides
It happens here as well as far as I can see (tested on a Debian 11 server 
running Django 3.2.12).


The "Chosen groups" box seems to be created by JavaScript; if I run it with 
JavaScript disabled then it doesn't exist. Apparently JavaScript creates the box 
and then populates it and accordingly removes stuff from "Available groups". 
Therefore it could be an error in Django; maybe for some reason that JavaScript 
doesn't always run correctly on Firefox.


If I were you I'd file a Django bug anyway.

Regards,

Antonis



On 13/04/2022 10.00, Mike Dewhirst wrote:

I don't know how long this has been happening for me.

Happens on Windows 10 in Mozilla Firefox but not Chrome.

 In the Admin User screen where there are two boxes of Groups labelled 
'Available groups' and 'Chosen groups' with controls to move groups between 
boxes, everything seems to work perfectly - until I refresh the screen!


On refresh, the Chosen groups box seems to slide across to the left and drop 
all its groups into the Available box! It quickly resumes its usual place on 
the right except that it is completely empty.


Shift refresh retrieves the data from the database and everything is OK.

The problem is that if an admin user accidentally saves after a refresh, they 
save that profile with no permissions and that user loses all access to their 
data.


I have tested identically on four different Django projects I look after with 
the same results. Django versions 3.2.12 and 3.2.13 running on Apache 2.4 on 
Ubuntu 20.04 and localhost on Windows 10 with the dev server. Also happens on 
Ubuntu 18.04 with nginx and running Mezzanine.


Any ideas? Debug strategy?

Not sure where to start.

Seems like a Mozilla issue but I have been known to get things wrong. Has 
anyone seen this?


Thanks

Mike




--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92661660-a500-f625-ac9a-d1404f99cb3d%40antonischristofides.com.


Possible Django Admin or auth bug or Mozilla bug

2022-04-13 Thread Mike Dewhirst

I don't know how long this has been happening for me.

Happens on Windows 10 in Mozilla Firefox but not Chrome.

 In the Admin User screen where there are two boxes of Groups labelled 
'Available groups' and 'Chosen groups' with controls to move groups 
between boxes, everything seems to work perfectly - until I refresh the 
screen!


On refresh, the Chosen groups box seems to slide across to the left and 
drop all its groups into the Available box! It quickly resumes its usual 
place on the right except that it is completely empty.


Shift refresh retrieves the data from the database and everything is OK.

The problem is that if an admin user accidentally saves after a refresh, 
they save that profile with no permissions and that user loses all 
access to their data.


I have tested identically on four different Django projects I look after 
with the same results. Django versions 3.2.12 and 3.2.13 running on 
Apache 2.4 on Ubuntu 20.04 and localhost on Windows 10 with the dev 
server. Also happens on Ubuntu 18.04 with nginx and running Mezzanine.


Any ideas? Debug strategy?

Not sure where to start.

Seems like a Mozilla issue but I have been known to get things wrong. 
Has anyone seen this?


Thanks

Mike


--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/69625b2c-dd6a-fac3-a9cf-b04a3a361356%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Django admin Ordering the display

2022-04-02 Thread Ali Hamza
How i Order this field descending order. i want completeorders show first 
then completemodules
[image: DeepinScreenshot_select-area_20220402171316.png]

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bd45879f-9f72-478e-9cf6-0b5a1bad0b55n%40googlegroups.com.


How to display models.full_clean() ValidationError in django admin?

2022-02-22 Thread ivory 954
Copy from:
https://stackoverflow.com/questions/71231549/how-to-display-models-full-clean-validationerror-in-django-admin

Question:

https://docs.djangoproject.com/en/4.0/ref/models/instances/#validating-objects
from django.core.exceptions import ValidationError
try: 
article.full_clean()
except ValidationError as e:
# Do something based on the errors contained in e.message_dict. 
# Display them to a user, or handle them programmatically. 
 pass

There tell us can *Display them to a user*, how to display errors in Admin?

When I do nothing:

   - When Settings.py Debug = True, it always render a *ValidationError at 
   /admin/xxx/xxx/xxx/change/* page.
   - When Settings.py Debug = False, it always render a *HTTP 500* page.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1bc61c0c-a80a-468a-87d6-4d1f6715e2b5n%40googlegroups.com.


Re: django-admin-autocomplete-filter

2022-02-09 Thread Kenedi Novriansyah
https://oldgamesdownload.com/file/53792-2/

On Wed, Feb 9, 2022 at 9:15 PM Kenedi Novriansyah <
kenedinovrians...@gmail.com> wrote:

> Battle Realms + Winter of the Wolf - GOG Games | Download Free GOG PC
> Games (gog-games.com)
> <https://gog-games.com/game/battle_realms_winter_of_the_wolf>
>
> On Wed, Feb 9, 2022 at 9:08 PM Kenedi Novriansyah <
> kenedinovrians...@gmail.com> wrote:
>
>> https://www45.zippyshare.com/v/07OKwKG1/file.html
>>
>> On Wed, Feb 9, 2022 at 9:06 PM DUSHYANT SINGH 
>> wrote:
>>
>>> Need updates from MERN
>>>
>>> On Wed, 9 Feb 2022, 19:21 Dilja E G,  wrote:
>>>
>>>> How to add django-admin-autocomplete-filter ? in my django filtter?
>>>>
>>>> --
>>>> 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 view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAJeNHmyrYUNiJN7VJWH0baWxh-dd9dTYd1f_PmfQnm6S9_ch2A%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAJeNHmyrYUNiJN7VJWH0baWxh-dd9dTYd1f_PmfQnm6S9_ch2A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CABqedVNQ-QqxVRU4g8YYaQH0i52hmVA7muDPixrw1kXqHu3%2BuA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CABqedVNQ-QqxVRU4g8YYaQH0i52hmVA7muDPixrw1kXqHu3%2BuA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADA6z%3DSfVo8jeRMVjCtQAk2udm5H8oFrouEyuv5OBE5mdfZxKA%40mail.gmail.com.


Re: django-admin-autocomplete-filter

2022-02-09 Thread Kenedi Novriansyah
Battle Realms + Winter of the Wolf - GOG Games | Download Free GOG PC Games
(gog-games.com)
<https://gog-games.com/game/battle_realms_winter_of_the_wolf>

On Wed, Feb 9, 2022 at 9:08 PM Kenedi Novriansyah <
kenedinovrians...@gmail.com> wrote:

> https://www45.zippyshare.com/v/07OKwKG1/file.html
>
> On Wed, Feb 9, 2022 at 9:06 PM DUSHYANT SINGH 
> wrote:
>
>> Need updates from MERN
>>
>> On Wed, 9 Feb 2022, 19:21 Dilja E G,  wrote:
>>
>>> How to add django-admin-autocomplete-filter ? in my django filtter?
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAJeNHmyrYUNiJN7VJWH0baWxh-dd9dTYd1f_PmfQnm6S9_ch2A%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAJeNHmyrYUNiJN7VJWH0baWxh-dd9dTYd1f_PmfQnm6S9_ch2A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABqedVNQ-QqxVRU4g8YYaQH0i52hmVA7muDPixrw1kXqHu3%2BuA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CABqedVNQ-QqxVRU4g8YYaQH0i52hmVA7muDPixrw1kXqHu3%2BuA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADA6z%3DS2PqK4qHi3arA3yq_NWuHqK2QnzKr3Y_yKb-btQtcUKw%40mail.gmail.com.


Re: django-admin-autocomplete-filter

2022-02-09 Thread Kenedi Novriansyah
https://www45.zippyshare.com/v/07OKwKG1/file.html

On Wed, Feb 9, 2022 at 9:06 PM DUSHYANT SINGH 
wrote:

> Need updates from MERN
>
> On Wed, 9 Feb 2022, 19:21 Dilja E G,  wrote:
>
>> How to add django-admin-autocomplete-filter ? in my django filtter?
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJeNHmyrYUNiJN7VJWH0baWxh-dd9dTYd1f_PmfQnm6S9_ch2A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAJeNHmyrYUNiJN7VJWH0baWxh-dd9dTYd1f_PmfQnm6S9_ch2A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABqedVNQ-QqxVRU4g8YYaQH0i52hmVA7muDPixrw1kXqHu3%2BuA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABqedVNQ-QqxVRU4g8YYaQH0i52hmVA7muDPixrw1kXqHu3%2BuA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADA6z%3DTs4ehA1MXSR6nGg6XmE7DrvL6MBDu5ATTQF1fH7j-YyA%40mail.gmail.com.


Re: django-admin-autocomplete-filter

2022-02-09 Thread DUSHYANT SINGH
Need updates from MERN

On Wed, 9 Feb 2022, 19:21 Dilja E G,  wrote:

> How to add django-admin-autocomplete-filter ? in my django filtter?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJeNHmyrYUNiJN7VJWH0baWxh-dd9dTYd1f_PmfQnm6S9_ch2A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJeNHmyrYUNiJN7VJWH0baWxh-dd9dTYd1f_PmfQnm6S9_ch2A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABqedVNQ-QqxVRU4g8YYaQH0i52hmVA7muDPixrw1kXqHu3%2BuA%40mail.gmail.com.


django-admin-autocomplete-filter

2022-02-09 Thread Dilja E G
How to add django-admin-autocomplete-filter ? in my django filtter?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJeNHmyrYUNiJN7VJWH0baWxh-dd9dTYd1f_PmfQnm6S9_ch2A%40mail.gmail.com.


change user creation form shown in Django admin

2022-01-07 Thread Anil Felipe Duggirala
hello,
I am using a custom user model.
I have created a form that includes an extra field:

## /users/forms.py

class CustomUserCreationForm(UserCreationForm):

class Meta(UserCreationForm):
model = CustomUser
fields = UserCreationForm.Meta.fields + ('phoneno',)

I am using this form successfully on my user facing signup page (I get 
username, phoneno and password). 
However I would like to achieve the same within the Django admin (have the 
'phoneno' field shown).
I have tried to achieve this doing:

## /users/admin.py

class CustomUserAdmin(UserAdmin):
add_form = CustomUserCreationForm
form = CustomUserChangeForm
model = CustomUser
list_display = ['email', 'username', 'phoneno', 'is_staff', ]

However, in the Django admin, when adding a new user, I still face the default 
form which only has the username and password (no 'phoneno')

thanks for your help.


Anil F

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aa199cca-44cb-4ca0-8806-6731e6d77d4b%40www.fastmail.com.


Sorting in Django admin site on different locale

2021-12-06 Thread Roland Leners
I am currently learning Python and Django via building a simple Web 
application. It involves objects with character fields that take values in 
different languages (French and Spanish) and I face an issue with sorting 
on those values in the Django administration site. 

Here are sample sets:
French: dataFr = ['être', 'gronder', 'gérer', 'éviter', 'exiger']
Spanish: dataEs = ['dos', 'acompasar', 'acompañar', 'día']

The following works fine in Python:

import locale
locale.setlocale(locale.LC_ALL,"fr_FR.utf8") 
sorted(dataFr, key=locale.strxfrm) 
> ['être', 'éviter', 'exiger', 'gérer', 'gronder'] #which is the desired 
result.
sorted(dataEs, key=locale.strxfrm)
> ['acompañar', 'acompasar', 'día', 'dos'] #which is also the desired 
result.

(French as well as Spanish local settings seem to work indifferently for 
sorting  French and Spanish)

In Django, the simplified model is as follows:

from django import models

class Word(models.Model):
content = models.CharField(max_length=32, unique=True)
class Meta:
abstract = True

class FrenchWord(Word)

The relevant part of the admin.py file is:

from django.contrib import admin
from .models import FrenchWord

@admin.register(FrenchWord)
class FrenchWord(admin.ModelAdmin):
list_display = ('content',)
ordering = ('content',)

Now my question is how to enforce ordering according to the fr_FR.utf8 
locale? I have tried all kinds of stuff, taking inspiration from various 
sites, but I do not succeed.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/865309b0-8869-4542-8ff4-b4941ecd4f47n%40googlegroups.com.


Re: Issue in rendering of Inline forms on Django Admin site

2021-12-01 Thread Gabo LaTo
Nope, sorry I missread

El mié, 1 de dic. de 2021 a la(s) 19:05, Gabo LaTo (elgatogabr...@gmail.com)
escribió:

> Aren't you missing the model class attribute in TestMyModelCreate?
>
> Like this:
>
> class TestMyModelCreate(admin.ModelAdmin):
> model = MyModel
> fields = ['text', ]
> inlines = [RelatedModelInlineTabular]
>
>
>
> El lun, 29 de nov. de 2021 a la(s) 20:28, 'Andrea Arighi' via Django users
> (django-users@googlegroups.com) escribió:
>
>> Good evening,
>> I am encountering a weird bug when rendering Inline forms on the "Add"
>> view of a ModelAdmin.
>>
>> Here is a minimum example with Django version 2.2.4
>>
>> - - - - - - -
>>
>> in models.py:
>>
>> class MyModel(models.Model):
>> text = models.CharField(max_length=100)
>>
>> class RelatedModel(models.Model):
>> parent = models.ForeignKey(MyModel, null=False, on_delete=models.CASCADE)
>> number = models.DecimalField(decimal_places=2, max_digits=10, 
>> null=False, blank=False)
>>
>>
>> in admin.py:
>>
>> class RelatedModelInlineTabular(admin.TabularInline):
>> model = RelatedModel
>> show_change_link = False
>> fields = ("number", )
>>
>> class TestMyModelCreate(admin.ModelAdmin):
>> fields = ['text', ]
>> inlines = [RelatedModelInlineTabular]
>>
>> admin.site.register(MyModel, TestMyModelCreate)
>>
>>
>> Steps to replicate:
>>
>>- Login to django admin website
>>- open the "add" view for MyModel (i.e. navigate to the list of
>>Models and click on the "Add new" button
>>
>>
>> Expected result:
>> The form displays an empty text field. Below that, an Inline form is
>> displayed with 3 empty rows for potential related instances of
>> RelatedModel
>>
>> Actual result:
>> The Inline form is displayed twice, each instance with its own 3 empty
>> rows, as if I had specified it twice.
>>
>> - - - - - -
>> I attach screenshots of the actual page ( Discount is the related
>> Model). Please note that I get the same result with both StackedInline and
>> TabularInline.
>>
>> [image: immagine.png]
>>
>> Am I making some trivial error here that could explain what's happening?
>> Or is this is a known bug? Thank you in advance to anyone that will help.
>>
>> Best regards
>> *  *  *  *  *
>> Andrea Arighi ~ Software Developer
>> Please consider the environment before printing this email
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJzUX%3D68ejwz2Q0Lwvarw-hA%3DV5xsKfL%3D%2BHrsLzuHDkF2_ApmA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAJzUX%3D68ejwz2Q0Lwvarw-hA%3DV5xsKfL%3D%2BHrsLzuHDkF2_ApmA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF6hzDOmrN4dOc_LHxQmfXSWAuaR63gcEPwou3S-Wq8XHkTxgQ%40mail.gmail.com.


Re: Issue in rendering of Inline forms on Django Admin site

2021-12-01 Thread Gabo LaTo
Aren't you missing the model class attribute in TestMyModelCreate?

Like this:

class TestMyModelCreate(admin.ModelAdmin):
model = MyModel
fields = ['text', ]
inlines = [RelatedModelInlineTabular]



El lun, 29 de nov. de 2021 a la(s) 20:28, 'Andrea Arighi' via Django users (
django-users@googlegroups.com) escribió:

> Good evening,
> I am encountering a weird bug when rendering Inline forms on the "Add"
> view of a ModelAdmin.
>
> Here is a minimum example with Django version 2.2.4
>
> - - - - - - -
>
> in models.py:
>
> class MyModel(models.Model):
> text = models.CharField(max_length=100)
>
> class RelatedModel(models.Model):
> parent = models.ForeignKey(MyModel, null=False, on_delete=models.CASCADE)
> number = models.DecimalField(decimal_places=2, max_digits=10, null=False, 
> blank=False)
>
>
> in admin.py:
>
> class RelatedModelInlineTabular(admin.TabularInline):
> model = RelatedModel
> show_change_link = False
> fields = ("number", )
>
> class TestMyModelCreate(admin.ModelAdmin):
> fields = ['text', ]
>     inlines = [RelatedModelInlineTabular]
>
> admin.site.register(MyModel, TestMyModelCreate)
>
>
> Steps to replicate:
>
>- Login to django admin website
>- open the "add" view for MyModel (i.e. navigate to the list of Models
>and click on the "Add new" button
>
>
> Expected result:
> The form displays an empty text field. Below that, an Inline form is
> displayed with 3 empty rows for potential related instances of
> RelatedModel
>
> Actual result:
> The Inline form is displayed twice, each instance with its own 3 empty
> rows, as if I had specified it twice.
>
> - - - - - -
> I attach screenshots of the actual page ( Discount is the related Model).
> Please note that I get the same result with both StackedInline and
> TabularInline.
>
> [image: immagine.png]
>
> Am I making some trivial error here that could explain what's happening?
> Or is this is a known bug? Thank you in advance to anyone that will help.
>
> Best regards
> *  *  *  *  *
> Andrea Arighi ~ Software Developer
> Please consider the environment before printing this email
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJzUX%3D68ejwz2Q0Lwvarw-hA%3DV5xsKfL%3D%2BHrsLzuHDkF2_ApmA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJzUX%3D68ejwz2Q0Lwvarw-hA%3DV5xsKfL%3D%2BHrsLzuHDkF2_ApmA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF6hzDOLZ8%2B3Q_t7da8Hjw1uaYKvLAE5m8jx2MkwgG9ji8eBAw%40mail.gmail.com.


Issue in rendering of Inline forms on Django Admin site

2021-11-29 Thread 'Andrea Arighi' via Django users
Good evening,
I am encountering a weird bug when rendering Inline forms on the "Add" view
of a ModelAdmin.

Here is a minimum example with Django version 2.2.4

- - - - - - -

in models.py:

class MyModel(models.Model):
text = models.CharField(max_length=100)

class RelatedModel(models.Model):
parent = models.ForeignKey(MyModel, null=False, on_delete=models.CASCADE)
number = models.DecimalField(decimal_places=2, max_digits=10,
null=False, blank=False)


in admin.py:

class RelatedModelInlineTabular(admin.TabularInline):
model = RelatedModel
show_change_link = False
fields = ("number", )

class TestMyModelCreate(admin.ModelAdmin):
fields = ['text', ]
inlines = [RelatedModelInlineTabular]

admin.site.register(MyModel, TestMyModelCreate)


Steps to replicate:

   - Login to django admin website
   - open the "add" view for MyModel (i.e. navigate to the list of Models
   and click on the "Add new" button


Expected result:
The form displays an empty text field. Below that, an Inline form is
displayed with 3 empty rows for potential related instances of RelatedModel

Actual result:
The Inline form is displayed twice, each instance with its own 3 empty
rows, as if I had specified it twice.

- - - - - -
I attach screenshots of the actual page ( Discount is the related Model).
Please note that I get the same result with both StackedInline and
TabularInline.

[image: immagine.png]

Am I making some trivial error here that could explain what's happening? Or
is this is a known bug? Thank you in advance to anyone that will help.

Best regards
*  *  *  *  *
Andrea Arighi ~ Software Developer
Please consider the environment before printing this email

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJzUX%3D68ejwz2Q0Lwvarw-hA%3DV5xsKfL%3D%2BHrsLzuHDkF2_ApmA%40mail.gmail.com.


Re: Django Admin Login

2021-11-09 Thread Aashish Kumar
Just make the path blank of admin.site.url in main urls.py file

On Tue, 9 Nov 2021 at 11:38 PM, webmbackslash 
wrote:

> Habdle it in urls.py file.
> But are you sure you want all your site viewed in admin mode?
>
> Il mar 9 nov 2021, 15:21 Abhi Sharma  ha scritto:
>
>> Hello,
>> We have a Django admin URL like https://abc.com/admin/, it's working
>> fine however we want to proxy with a domain for admin url like
>> https://abc.com/
>>
>> We want to remove */admin* from the URL.
>>
>>
>> Regards,
>> Abhishek
>>
> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/39bd9eb7-5002-4cc1-afd0-02eaa216da10n%40googlegroups.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANPmrzPGzuScdg_yLEr-Z3QcZW7gKJoRQx_ehvNp9fC47UuBYg%40mail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACTAcrwQfc8a6Oyt_%3DbKUyh22%3DqPGPOSdjys2tHtgD%3D4T0EbFw%40mail.gmail.com.


Re: Django Admin Login

2021-11-09 Thread webmbackslash
Habdle it in urls.py file.
But are you sure you want all your site viewed in admin mode?

Il mar 9 nov 2021, 15:21 Abhi Sharma  ha scritto:

> Hello,
> We have a Django admin URL like https://abc.com/admin/, it's working fine
> however we want to proxy with a domain for admin url like https://abc.com/
>
> We want to remove */admin* from the URL.
>
>
> Regards,
> Abhishek
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/39bd9eb7-5002-4cc1-afd0-02eaa216da10n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/39bd9eb7-5002-4cc1-afd0-02eaa216da10n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANPmrzPGzuScdg_yLEr-Z3QcZW7gKJoRQx_ehvNp9fC47UuBYg%40mail.gmail.com.


Django Admin Login

2021-11-09 Thread Abhi Sharma
Hello,
We have a Django admin URL like https://abc.com/admin/, it's working fine 
however we want to proxy with a domain for admin url like https://abc.com/

We want to remove */admin* from the URL.


Regards,
Abhishek

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/39bd9eb7-5002-4cc1-afd0-02eaa216da10n%40googlegroups.com.


Re: Django admin redirects behind nginx proxy subpath

2021-10-30 Thread Karthik Karthik
yaa
On Saturday, 23 October 2021 at 04:44:10 UTC-7 268088...@gmail.com wrote:

> I don't know but I'm interested in that
>
> 在2021年10月20日星期三 UTC+8 上午3:37:04 写道:
>
>>
>> I am running a small django app with django admin.
>> In fact, I only use django admin to edit a few models.
>>
>> It works fine in local and behind a simple proxy reverse, but now I have 
>> this kind a rewrite that changes the path: (it's a nginx ingress rewrite 
>> rule for Kubernetes)
>>
>> path: /diagnosis-admin(/|$)(.*) => $2
>>
>> Wich means, urls such as mydomain.com/diagnosis-admin redirect to 
>> localhost/ (mind the path change.
>>
>> When I try to access the admin at mydomain.com/diagnosis-admin/admin, 
>> django tries to redirect to mydomain.com/admin/, which leads nowhere 
>> because it falls on the proxy:
>>
>>
>>1. Request URL: 
>>   https://mydomain.com/diagnosis-admin/admin
>>   2. Request Method: 
>>   GET
>>   3. Status Code: 
>>   301 
>>   4. Remote Address: 
>>   138.21.17.33:3128
>>   5. Referrer Policy: 
>>   strict-origin-when-cross-origin
>>   1. Response Headers
>>   1. content-length: 
>>   0
>>   2. content-type: 
>>   text/html; charset=utf-8
>>   3. date: 
>>   Tue, 19 Oct 2021 15:11:42 GMT
>>   4. location: 
>>   /admin/
>>   5. script_name: 
>>   /diagnosis-admin
>>   6. strict-transport-security: 
>>   max-age=15724800; includeSubDomains
>>   7. x-content-type-options: 
>>   nosniff
>>
>>
>> I had this problems with other applicative frameworks but could solve it 
>> since they can interpret the FORWARDED_HOST, FORWARDED_PORT and 
>> FORWARDED_PATH headers provided by the proxy.
>>
>> Searching the internets gave me tons of solutions for reverse proxy with 
>> simple rewrite rules with no path alterations, but here I am stuck 
>>
>> I have no idea how to solve this withing django. Any help will be much 
>> appreciated
>>
>>
>> Additionnal information:
>> I run django with "python manage.py runserver 0.0.0.0:8000" on a docker 
>> container (running through GKE)
>>
>> Everything is pretty standard, I ran the basic django project scafolding, 
>> setup the database, auto migrated the models and that's about it. I can 
>> provide additionnal files if needed
>>
>>
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6dd77ed7-8645-4306-ab0a-01279eb3cb96n%40googlegroups.com.


Re: Django admin redirects behind nginx proxy subpath

2021-10-23 Thread 银色配色
I don't know but I'm interested in that

在2021年10月20日星期三 UTC+8 上午3:37:04 写道:

>
> I am running a small django app with django admin.
> In fact, I only use django admin to edit a few models.
>
> It works fine in local and behind a simple proxy reverse, but now I have 
> this kind a rewrite that changes the path: (it's a nginx ingress rewrite 
> rule for Kubernetes)
>
> path: /diagnosis-admin(/|$)(.*) => $2
>
> Wich means, urls such as mydomain.com/diagnosis-admin redirect to 
> localhost/ (mind the path change.
>
> When I try to access the admin at mydomain.com/diagnosis-admin/admin, 
> django tries to redirect to mydomain.com/admin/, which leads nowhere 
> because it falls on the proxy:
>
>
>1. Request URL: 
>   https://mydomain.com/diagnosis-admin/admin
>   2. Request Method: 
>   GET
>   3. Status Code: 
>   301 
>   4. Remote Address: 
>   138.21.17.33:3128
>   5. Referrer Policy: 
>   strict-origin-when-cross-origin
>   1. Response Headers
>   1. content-length: 
>   0
>   2. content-type: 
>   text/html; charset=utf-8
>   3. date: 
>   Tue, 19 Oct 2021 15:11:42 GMT
>   4. location: 
>   /admin/
>   5. script_name: 
>   /diagnosis-admin
>   6. strict-transport-security: 
>   max-age=15724800; includeSubDomains
>   7. x-content-type-options: 
>   nosniff
>
>
> I had this problems with other applicative frameworks but could solve it 
> since they can interpret the FORWARDED_HOST, FORWARDED_PORT and 
> FORWARDED_PATH headers provided by the proxy.
>
> Searching the internets gave me tons of solutions for reverse proxy with 
> simple rewrite rules with no path alterations, but here I am stuck 
>
> I have no idea how to solve this withing django. Any help will be much 
> appreciated
>
>
> Additionnal information:
> I run django with "python manage.py runserver 0.0.0.0:8000" on a docker 
> container (running through GKE)
>
> Everything is pretty standard, I ran the basic django project scafolding, 
> setup the database, auto migrated the models and that's about it. I can 
> provide additionnal files if needed
>
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e76405e1-c4ec-44da-be3f-cd30cdeb98c2n%40googlegroups.com.


Django admin redirects behind nginx proxy subpath

2021-10-19 Thread Rodolphe Gohard

I am running a small django app with django admin.
In fact, I only use django admin to edit a few models.

It works fine in local and behind a simple proxy reverse, but now I have 
this kind a rewrite that changes the path: (it's a nginx ingress rewrite 
rule for Kubernetes)

path: /diagnosis-admin(/|$)(.*) => $2

Wich means, urls such as mydomain.com/diagnosis-admin redirect to 
localhost/ (mind the path change.

When I try to access the admin at mydomain.com/diagnosis-admin/admin, 
django tries to redirect to mydomain.com/admin/, which leads nowhere 
because it falls on the proxy:


   1. Request URL: 
  https://mydomain.com/diagnosis-admin/admin
  2. Request Method: 
  GET
  3. Status Code: 
  301 
  4. Remote Address: 
  138.21.17.33:3128
  5. Referrer Policy: 
  strict-origin-when-cross-origin
  1. Response Headers
  1. content-length: 
  0
  2. content-type: 
  text/html; charset=utf-8
  3. date: 
  Tue, 19 Oct 2021 15:11:42 GMT
  4. location: 
  /admin/
  5. script_name: 
  /diagnosis-admin
  6. strict-transport-security: 
  max-age=15724800; includeSubDomains
  7. x-content-type-options: 
  nosniff
   

I had this problems with other applicative frameworks but could solve it 
since they can interpret the FORWARDED_HOST, FORWARDED_PORT and 
FORWARDED_PATH headers provided by the proxy.

Searching the internets gave me tons of solutions for reverse proxy with 
simple rewrite rules with no path alterations, but here I am stuck 

I have no idea how to solve this withing django. Any help will be much 
appreciated


Additionnal information:
I run django with "python manage.py runserver 0.0.0.0:8000" on a docker 
container (running through GKE)

Everything is pretty standard, I ran the basic django project scafolding, 
setup the database, auto migrated the models and that's about it. I can 
provide additionnal files if needed



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e962cece-fc2e-4010-aaf4-191d74fe74fdn%40googlegroups.com.


Re: django admin

2021-10-10 Thread David Nugent
Just a general note but *collectstatic* should not be required for Django
development in localdev.

Django will locate static files using STATICFILES_FINDERS when serving
static is enabled (which normally is the case for localdev). It uses the
same algorithm to do so as *collectstatic*.

If you're getting 404s for static files, then there can be a number of
causes, apart from the usual PEBCAK:

   - STATICFILES_FINDERS does not include all of the required finders
   (filesystem, app_directories) If not set, these are the default anyway.
   - One or more directories is missing from STATICFILES_DIRS.

In the case of admin assets, these should always render except in the first
case, so after checking on these settings check the traceback in the
console to help triage the cause.

Regards, David

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE5VhgXqtk9oZZCxivdC7Bobc74uX4y-sMTpjcQRVhBm%2B5599Q%40mail.gmail.com.


RE: django admin

2021-10-10 Thread Mike Dewhirst
Try manage.py collectstatic--(Unsigned mail from my phone)
 Original message From: Baraka Nzavi  
Date: 11/10/21  07:32  (GMT+10:00) To: Django users 
 Subject: django admin hello guys...what leads 
to the admin interface misbehaving in that the styling does not show



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c6a6bc37-1f3a-45d5-9b21-509295dfd220n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/616368e2.1c69fb81.b6c16.8d20SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Re: django admin

2021-10-10 Thread Kasper Laudrup

On 10/10/2021 21.31, Baraka Nzavi wrote:
hello guys...what leads to the admin interface misbehaving in that the 
styling does not show




Most likely the stylesheets (.css files) are not available to the 
browser for some reason.


Impossible to know what the reason for that might be unless you provide 
some details.


Learn how to ask a question that someone has a chance to answer if you 
want to get some help.


Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3cb1e85e-35f1-148a-9232-1179afe21df5%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


django admin

2021-10-10 Thread Baraka Nzavi
hello guys...what leads to the admin interface misbehaving in that the 
styling does not show

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c6a6bc37-1f3a-45d5-9b21-509295dfd220n%40googlegroups.com.


Re: django-admin doesn't display choices and it's not possible to select one

2021-09-22 Thread bnmng
Fantastic!  But now I wonder why it's not working on some of your browsers

On Wednesday, September 22, 2021 at 4:18:14 AM UTC-4 nine...@gmail.com 
wrote:

> Hi,
>
> Eureka!!! 
> Benjamin, you are right. I changed my browser and it worked.
>
> Thank for you advice.
>
> Best wishes,
> Maria
>
> On Tuesday, September 21, 2021 at 9:41:18 AM UTC+2 Mariangeles Mendoza 
> wrote:
>
>> Thank you very much!!!
>>
>> I will try other browsers. I have used Firefox and Brave.
>> No, I am not using other custom widget.
>>
>> Thanks again,
>> Maria 
>>
>> On Monday, September 20, 2021 at 1:59:25 PM UTC+2 bnmng wrote:
>>
>>> Hi.  I don't see anything in your code samples that would cause this.  
>>>  One line in admin.py caused the server to stop because of the extra 
>>> parenthesis, and the default for status should be 'r' instead of  
>>> 'refereed', but those don't cause the problem you're describing.  Maybe a 
>>> browser issue?  Maybe there's something with a custom widget that isn't the 
>>> samples?
>>>
>>> On Monday, September 13, 2021 at 9:13:48 AM UTC-4 nine...@gmail.com 
>>> wrote:
>>>
>>>> Hi,
>>>> I'm very new in Django. I'm making a cv, but I don't get select a 
>>>> choice through the django-admin web. I've searched solutions in the 
>>>> community but I cant't solve it.
>>>>
>>>> My code is:
>>>>
>>>> *Models.py*
>>>> """"
>>>> class Article(models.Model):
>>>> 
>>>> year = models.PositiveIntegerField(
>>>> validators=[
>>>> MinValueValidator(1900), 
>>>> MaxValueValidator(datetime.now().year)], null=True, 
>>>> blank=True)
>>>>
>>>> title = models.CharField(max_length=200)
>>>> author = models.ManyToManyField(Author)
>>>> journal = models.ForeignKey(Journal, models.CASCADE)
>>>> summary = models.TextField(max_length=1000, null=True, blank=True, 
>>>>help_text="Brief description of the 
>>>> article")
>>>>
>>>> PUB_TYPE = (
>>>> ('r', 'refereed'),
>>>> ('t', 'technical report'),
>>>> ('p', 'proceeding'),
>>>> ('b', 'book'),
>>>> ('c', 'book chapter'),
>>>> )
>>>>
>>>> status = models.CharField(max_length=1, choices=PUB_TYPE, 
>>>> default='refereed', 
>>>>help_text='publication type')
>>>> 
>>>> class Meta:
>>>> ordering = ['year']
>>>> 
>>>> def get_absolute_url(self):
>>>> return reverse('article-detail', args=[str(self.id)])
>>>>
>>>> def __str__(self):
>>>> return self.title
>>>> """"
>>>>
>>>> *admin.py*
>>>> """
>>>> @admin.register(Article)
>>>> class ArticleAdmin(admin.ModelAdmin):
>>>> list_display = ('title', 'journal', 'year', 'status')
>>>> list_filter = (("year", "journal")
>>>> ordering = ('-year',)
>>>> search_fields= ('author',)
>>>> filter_horizontal = ('author',)
>>>> raw_id_fields = ('journal',)
>>>> """
>>>> When I click in the status button (attached image), the  choices aren't 
>>>> displayed and i can't seletc one.
>>>> I would be very grateful for any idea.
>>>>
>>>> Thanks in advance,
>>>> Maria
>>>>
>>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ae3983dd-1912-42f0-b68d-f996a495e67en%40googlegroups.com.


Re: django-admin doesn't display choices and it's not possible to select one

2021-09-22 Thread Mariangeles Mendoza
Hi,

Eureka!!! 
Benjamin, you are right. I changed my browser and it worked.

Thank for you advice.

Best wishes,
Maria

On Tuesday, September 21, 2021 at 9:41:18 AM UTC+2 Mariangeles Mendoza 
wrote:

> Thank you very much!!!
>
> I will try other browsers. I have used Firefox and Brave.
> No, I am not using other custom widget.
>
> Thanks again,
> Maria 
>
> On Monday, September 20, 2021 at 1:59:25 PM UTC+2 bnmng wrote:
>
>> Hi.  I don't see anything in your code samples that would cause this.  
>>  One line in admin.py caused the server to stop because of the extra 
>> parenthesis, and the default for status should be 'r' instead of  
>> 'refereed', but those don't cause the problem you're describing.  Maybe a 
>> browser issue?  Maybe there's something with a custom widget that isn't the 
>> samples?
>>
>> On Monday, September 13, 2021 at 9:13:48 AM UTC-4 nine...@gmail.com 
>> wrote:
>>
>>> Hi,
>>> I'm very new in Django. I'm making a cv, but I don't get select a choice 
>>> through the django-admin web. I've searched solutions in the community but 
>>> I cant't solve it.
>>>
>>> My code is:
>>>
>>> *Models.py*
>>> """"
>>> class Article(models.Model):
>>> 
>>> year = models.PositiveIntegerField(
>>> validators=[
>>> MinValueValidator(1900), 
>>> MaxValueValidator(datetime.now().year)], null=True, 
>>> blank=True)
>>>
>>> title = models.CharField(max_length=200)
>>> author = models.ManyToManyField(Author)
>>> journal = models.ForeignKey(Journal, models.CASCADE)
>>> summary = models.TextField(max_length=1000, null=True, blank=True, 
>>>help_text="Brief description of the 
>>> article")
>>>
>>> PUB_TYPE = (
>>> ('r', 'refereed'),
>>> ('t', 'technical report'),
>>> ('p', 'proceeding'),
>>> ('b', 'book'),
>>> ('c', 'book chapter'),
>>> )
>>>
>>> status = models.CharField(max_length=1, choices=PUB_TYPE, 
>>> default='refereed', 
>>>help_text='publication type')
>>> 
>>> class Meta:
>>> ordering = ['year']
>>> 
>>> def get_absolute_url(self):
>>> return reverse('article-detail', args=[str(self.id)])
>>>
>>> def __str__(self):
>>> return self.title
>>> """"
>>>
>>> *admin.py*
>>> """
>>> @admin.register(Article)
>>> class ArticleAdmin(admin.ModelAdmin):
>>> list_display = ('title', 'journal', 'year', 'status')
>>> list_filter = (("year", "journal")
>>> ordering = ('-year',)
>>> search_fields= ('author',)
>>> filter_horizontal = ('author',)
>>> raw_id_fields = ('journal',)
>>> """
>>> When I click in the status button (attached image), the  choices aren't 
>>> displayed and i can't seletc one.
>>> I would be very grateful for any idea.
>>>
>>> Thanks in advance,
>>> Maria
>>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/61e348de-660e-4cdd-bf39-ef14d839198bn%40googlegroups.com.


Re: django-admin doesn't display choices and it's not possible to select one

2021-09-21 Thread Mariangeles Mendoza
Thank you very much!!!

I will try other browsers. I have used Firefox and Brave.
No, I am not using other custom widget.

Thanks again,
Maria 

On Monday, September 20, 2021 at 1:59:25 PM UTC+2 bnmng wrote:

> Hi.  I don't see anything in your code samples that would cause this.  
>  One line in admin.py caused the server to stop because of the extra 
> parenthesis, and the default for status should be 'r' instead of  
> 'refereed', but those don't cause the problem you're describing.  Maybe a 
> browser issue?  Maybe there's something with a custom widget that isn't the 
> samples?
>
> On Monday, September 13, 2021 at 9:13:48 AM UTC-4 nine...@gmail.com wrote:
>
>> Hi,
>> I'm very new in Django. I'm making a cv, but I don't get select a choice 
>> through the django-admin web. I've searched solutions in the community but 
>> I cant't solve it.
>>
>> My code is:
>>
>> *Models.py*
>> """"
>> class Article(models.Model):
>> 
>> year = models.PositiveIntegerField(
>> validators=[
>> MinValueValidator(1900), 
>> MaxValueValidator(datetime.now().year)], null=True, 
>> blank=True)
>>
>> title = models.CharField(max_length=200)
>> author = models.ManyToManyField(Author)
>> journal = models.ForeignKey(Journal, models.CASCADE)
>> summary = models.TextField(max_length=1000, null=True, blank=True, 
>>help_text="Brief description of the 
>> article")
>>
>> PUB_TYPE = (
>> ('r', 'refereed'),
>> ('t', 'technical report'),
>> ('p', 'proceeding'),
>> ('b', 'book'),
>> ('c', 'book chapter'),
>> )
>>
>> status = models.CharField(max_length=1, choices=PUB_TYPE, 
>> default='refereed', 
>>help_text='publication type')
>> 
>> class Meta:
>> ordering = ['year']
>> 
>> def get_absolute_url(self):
>> return reverse('article-detail', args=[str(self.id)])
>>
>> def __str__(self):
>> return self.title
>> """"
>>
>> *admin.py*
>> """
>> @admin.register(Article)
>> class ArticleAdmin(admin.ModelAdmin):
>> list_display = ('title', 'journal', 'year', 'status')
>> list_filter = (("year", "journal")
>> ordering = ('-year',)
>> search_fields= ('author',)
>> filter_horizontal = ('author',)
>> raw_id_fields = ('journal',)
>> """
>> When I click in the status button (attached image), the  choices aren't 
>> displayed and i can't seletc one.
>> I would be very grateful for any idea.
>>
>> Thanks in advance,
>> Maria
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/08bb4225-200e-4c1f-bfca-09c2b05fa9c5n%40googlegroups.com.


Re: django-admin doesn't display choices and it's not possible to select one

2021-09-20 Thread bnmng
Hi.  I don't see anything in your code samples that would cause this.   One 
line in admin.py caused the server to stop because of the extra 
parenthesis, and the default for status should be 'r' instead of  
'refereed', but those don't cause the problem you're describing.  Maybe a 
browser issue?  Maybe there's something with a custom widget that isn't the 
samples?

On Monday, September 13, 2021 at 9:13:48 AM UTC-4 nine...@gmail.com wrote:

> Hi,
> I'm very new in Django. I'm making a cv, but I don't get select a choice 
> through the django-admin web. I've searched solutions in the community but 
> I cant't solve it.
>
> My code is:
>
> *Models.py*
> """"
> class Article(models.Model):
> 
> year = models.PositiveIntegerField(
> validators=[
> MinValueValidator(1900), 
> MaxValueValidator(datetime.now().year)], null=True, 
> blank=True)
>
> title = models.CharField(max_length=200)
> author = models.ManyToManyField(Author)
> journal = models.ForeignKey(Journal, models.CASCADE)
> summary = models.TextField(max_length=1000, null=True, blank=True, 
>help_text="Brief description of the 
> article")
>
> PUB_TYPE = (
> ('r', 'refereed'),
> ('t', 'technical report'),
> ('p', 'proceeding'),
> ('b', 'book'),
> ('c', 'book chapter'),
> )
>
> status = models.CharField(max_length=1, choices=PUB_TYPE, 
> default='refereed', 
>help_text='publication type')
> 
> class Meta:
> ordering = ['year']
> 
> def get_absolute_url(self):
> return reverse('article-detail', args=[str(self.id)])
>
> def __str__(self):
> return self.title
> """"
>
> *admin.py*
> """
> @admin.register(Article)
> class ArticleAdmin(admin.ModelAdmin):
> list_display = ('title', 'journal', 'year', 'status')
> list_filter = (("year", "journal")
> ordering = ('-year',)
> search_fields= ('author',)
> filter_horizontal = ('author',)
> raw_id_fields = ('journal',)
> """
> When I click in the status button (attached image), the  choices aren't 
> displayed and i can't seletc one.
> I would be very grateful for any idea.
>
> Thanks in advance,
> Maria
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3cc17c27-7c78-4f60-8a59-894711f182a1n%40googlegroups.com.


django-admin doesn't display choices and it's not possible to select one

2021-09-13 Thread Mariangeles Mendoza
Hi,
I'm very new in Django. I'm making a cv, but I don't get select a choice 
through the django-admin web. I've searched solutions in the community but 
I cant't solve it.

My code is:

*Models.py*
""""
class Article(models.Model):

year = models.PositiveIntegerField(
validators=[
MinValueValidator(1900), 
MaxValueValidator(datetime.now().year)], null=True, 
blank=True)
   
title = models.CharField(max_length=200)
author = models.ManyToManyField(Author)
journal = models.ForeignKey(Journal, models.CASCADE)
summary = models.TextField(max_length=1000, null=True, blank=True, 
   help_text="Brief description of the article")
   
PUB_TYPE = (
('r', 'refereed'),
('t', 'technical report'),
('p', 'proceeding'),
('b', 'book'),
('c', 'book chapter'),
)

status = models.CharField(max_length=1, choices=PUB_TYPE, 
default='refereed', 
   help_text='publication type')

class Meta:
ordering = ['year']

def get_absolute_url(self):
return reverse('article-detail', args=[str(self.id)])

def __str__(self):
return self.title
""""

*admin.py*
"""
@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
list_display = ('title', 'journal', 'year', 'status')
list_filter = (("year", "journal")
ordering = ('-year',)
search_fields= ('author',)
filter_horizontal = ('author',)
raw_id_fields = ('journal',)
"""
When I click in the status button (attached image), the  choices aren't 
displayed and i can't seletc one.
I would be very grateful for any idea.

Thanks in advance,
Maria

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/30490e97-5c14-436b-970e-17676ad0d420n%40googlegroups.com.


Re: Django admin - how to change breadcrumbs 'Home' into 'Main menu'

2021-08-26 Thread Mike Dewhirst

On 27/08/2021 2:09 am, Nigel Copley wrote:
although I think you'd have to override the breadcrumb block in each 
of the public facing admin templates, it doesn't look to be easily 
done and making a home setting it's probably overkill


Overkill, underkill - looks like no other solution at the moment. I'll 
look a bit deeper.




On Thursday, 26 August 2021 at 16:50:11 UTC+1 Nigel Copley wrote:

haven't tried it but you could potentially just override the
"/admin/base.html" template in your templates directory

On Tuesday, 24 August 2021 at 02:02:14 UTC+1 Mike Dewhirst wrote:

We are using 'Home' in a different, more public, part of the
site and
have to adjust that first item in the Admin breadcrumbs to
'Menu' or
'Main menu' in order to keep the UX masters happy. Some of the
Admin is
public facing.

Looking at the source, I would have to override an awful lot of
templates with ...

{% translate 'Home' %}

It looks impossible to do elegantly. I shudder at scripting a
global
search and replace.

Is this worth putting in the effort to make 'Home' a setting -
if that
is even possible.

If so, how do I get started on that?

Thanks

Mike

-- 
Signed email is an absolute defence against phishing. This

email has
been signed with my private key. If you import my public key
you can
automatically decrypt my signature and be sure it came from
me. Just
ask and I'll send it to you. Your email software can handle
signing.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/76e4665b-cd9c-4bc2-b92f-0e6801b52c3fn%40googlegroups.com 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1ec2797d-97c8-4d0c-fd75-0558d111ed08%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Django admin - how to change breadcrumbs 'Home' into 'Main menu'

2021-08-26 Thread Mike Dewhirst

On 27/08/2021 1:50 am, Cale Roco wrote:
haven't tried it but you could potentially just override the 
"/admin/base.html" template in your templates directory


That does change it but only at the top level admin:index page which 
shows all the apps


Doesn't seem to be inherited by child pages.



On Tuesday, 24 August 2021 at 02:02:14 UTC+1 Mike Dewhirst wrote:

We are using 'Home' in a different, more public, part of the site and
have to adjust that first item in the Admin breadcrumbs to 'Menu' or
'Main menu' in order to keep the UX masters happy. Some of the
Admin is
public facing.

Looking at the source, I would have to override an awful lot of
templates with ...

{% translate 'Home' %}

It looks impossible to do elegantly. I shudder at scripting a global
search and replace.

Is this worth putting in the effort to make 'Home' a setting - if
that
is even possible.

If so, how do I get started on that?

Thanks

Mike

-- 
Signed email is an absolute defence against phishing. This email has

been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/80a0be6b-8064-45bf-b053-974c56d1b89dn%40googlegroups.com 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c1555c89-ce62-f317-008e-be6718abd796%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Django admin - how to change breadcrumbs 'Home' into 'Main menu'

2021-08-26 Thread Nigel Copley
although I think you'd have to override the breadcrumb block in each of the 
public facing admin templates, it doesn't look to be easily done and making 
a home setting it's probably overkill

On Thursday, 26 August 2021 at 16:50:11 UTC+1 Nigel Copley wrote:

> haven't tried it but you could potentially just override the 
> "/admin/base.html" template in your templates directory
>
> On Tuesday, 24 August 2021 at 02:02:14 UTC+1 Mike Dewhirst wrote:
>
>> We are using 'Home' in a different, more public, part of the site and 
>> have to adjust that first item in the Admin breadcrumbs to 'Menu' or 
>> 'Main menu' in order to keep the UX masters happy. Some of the Admin is 
>> public facing.
>>
>> Looking at the source, I would have to override an awful lot of 
>> templates with ...
>>
>> {% translate 'Home' %}
>>
>> It looks impossible to do elegantly. I shudder at scripting a global 
>> search and replace.
>>
>> Is this worth putting in the effort to make 'Home' a setting - if that 
>> is even possible.
>>
>> If so, how do I get started on that?
>>
>> Thanks
>>
>> Mike
>>
>> -- 
>> Signed email is an absolute defence against phishing. This email has
>> been signed with my private key. If you import my public key you can
>> automatically decrypt my signature and be sure it came from me. Just
>> ask and I'll send it to you. Your email software can handle signing.
>>
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/76e4665b-cd9c-4bc2-b92f-0e6801b52c3fn%40googlegroups.com.


Re: Django admin - how to change breadcrumbs 'Home' into 'Main menu'

2021-08-26 Thread Cale Roco
haven't tried it but you could potentially just override the 
"/admin/base.html" template in your templates directory

On Tuesday, 24 August 2021 at 02:02:14 UTC+1 Mike Dewhirst wrote:

> We are using 'Home' in a different, more public, part of the site and 
> have to adjust that first item in the Admin breadcrumbs to 'Menu' or 
> 'Main menu' in order to keep the UX masters happy. Some of the Admin is 
> public facing.
>
> Looking at the source, I would have to override an awful lot of 
> templates with ...
>
> {% translate 'Home' %}
>
> It looks impossible to do elegantly. I shudder at scripting a global 
> search and replace.
>
> Is this worth putting in the effort to make 'Home' a setting - if that 
> is even possible.
>
> If so, how do I get started on that?
>
> Thanks
>
> Mike
>
> -- 
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/80a0be6b-8064-45bf-b053-974c56d1b89dn%40googlegroups.com.


Django admin - how to change breadcrumbs 'Home' into 'Main menu'

2021-08-23 Thread Mike Dewhirst
We are using 'Home' in a different, more public, part of the site and 
have to adjust that first item in the Admin breadcrumbs to 'Menu' or 
'Main menu' in order to keep the UX masters happy. Some of the Admin is 
public facing.


Looking at the source, I would have to override an awful lot of 
templates with ...


{% translate 'Home' %}

It looks impossible to do elegantly. I shudder at scripting a global 
search and replace.


Is this worth putting in the effort to make 'Home' a setting - if that 
is even possible.


If so, how do I get started on that?

Thanks

Mike

--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3306675c-6079-324e-0fad-b0857a9140a8%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Display Hierarchical Categories in Django Admin

2021-08-12 Thread 'Rahul Chauhan' via Django users

Thanks for the suggestion.
But I don't want to use any third party addon/module such as MPTT or 
Tree-Beard.

Regards
R

On Thursday, August 12, 2021 at 2:35:18 PM UTC+5:30 sebasti...@gmail.com 
wrote:

> Hello Rahul,
>
> i Django MPTT tutorial you find in modely.py:
>
> from django.db import modelsfrom mptt.models import MPTTModel, TreeForeignKey
> class Genre(MPTTModel):
> name = models.CharField(max_length=50, unique=True)
> parent = TreeForeignKey('self', on_delete=models.CASCADE, null=True, 
> blank=True, related_name='children')
>
> class MPTTMeta:
> order_insertion_by = ['name']
>
>
> This works. 
>
>
> Regards
>
>
> Am Mi., 11. Aug. 2021 um 19:57 Uhr schrieb 'Rahul Chauhan' via Django 
> users :
>
>> Hi All,
>>
>> I have a category Model like this one which is based on *Adjacency List*.
>>
>> class Category(models.Model):
>> name = models.CharField(blank=False, max_length=200)
>> slug = models.SlugField(null=False)
>>
>> parent = models.ForeignKey('self', blank=True, null=True, 
>> related_name='child',on_delete=models.SET_NULL)
>>
>> I want to display the model has hierarchical/nested structure in the 
>> Django admin. There are modules available such as TreeBeard or Django-MPTT 
>> but I dont want to use them.
>>
>> Tried everything, but unable to achieve the above.
>>
>> Any help in this direction will be highly appreciated.
>>
>> Thanks.
>>
>> This e-mail is intended only for the named person or entity to which it is 
>> addressed and contains valuable business information that is privileged, 
>> confidential and/or otherwise protected from disclosure. If you received 
>> this e-mail in error, any review, use, dissemination, distribution or 
>> copying of this e-mail is strictly prohibited. Please notify us immediately 
>> of the error via e-mail to discl...@email-abuse.com and please delete the 
>> e-mail from your system, retaining no copies in any media. We appreciate 
>> your cooperation.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/25736f0b-19e3-4ad2-a774-552774425894n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/25736f0b-19e3-4ad2-a774-552774425894n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
-- 
This e-mail is intended only for the named person or entity to which it is 
addressed and contains valuable business information that is privileged, 
confidential and/or otherwise protected from disclosure. If you received 
this e-mail in error, any review, use, dissemination, distribution or 
copying of this e-mail is strictly prohibited. Please notify us immediately 
of the error via e-mail to disclai...@email-abuse.com 
<mailto:disclai...@email-abuse.com> and please delete the e-mail from your 
system, retaining no copies in any media. We appreciate your cooperation.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/07d7d213-d48c-4efc-8b5d-eedc306dd5c3n%40googlegroups.com.


Re: Display Hierarchical Categories in Django Admin

2021-08-12 Thread Sebastian Jung
Hello Rahul,

i Django MPTT tutorial you find in modely.py:

from django.db import modelsfrom mptt.models import MPTTModel, TreeForeignKey
class Genre(MPTTModel):
name = models.CharField(max_length=50, unique=True)
parent = TreeForeignKey('self', on_delete=models.CASCADE,
null=True, blank=True, related_name='children')

class MPTTMeta:
order_insertion_by = ['name']


This works.


Regards


Am Mi., 11. Aug. 2021 um 19:57 Uhr schrieb 'Rahul Chauhan' via Django users
:

> Hi All,
>
> I have a category Model like this one which is based on *Adjacency List*.
>
> class Category(models.Model):
> name = models.CharField(blank=False, max_length=200)
> slug = models.SlugField(null=False)
>
> parent = models.ForeignKey('self', blank=True, null=True, 
> related_name='child',on_delete=models.SET_NULL)
>
> I want to display the model has hierarchical/nested structure in the
> Django admin. There are modules available such as TreeBeard or Django-MPTT
> but I dont want to use them.
>
> Tried everything, but unable to achieve the above.
>
> Any help in this direction will be highly appreciated.
>
> Thanks.
>
> This e-mail is intended only for the named person or entity to which it is 
> addressed and contains valuable business information that is privileged, 
> confidential and/or otherwise protected from disclosure. If you received this 
> e-mail in error, any review, use, dissemination, distribution or copying of 
> this e-mail is strictly prohibited. Please notify us immediately of the error 
> via e-mail to disclai...@email-abuse.com and please delete the e-mail from 
> your system, retaining no copies in any media. We appreciate your cooperation.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/25736f0b-19e3-4ad2-a774-552774425894n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/25736f0b-19e3-4ad2-a774-552774425894n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKGT9mxUcOH%2Bvs8ZkVmidnFkZgq-TNv%3Db2HvH%3Dtj%3DkB-3YafoQ%40mail.gmail.com.


Display Hierarchical Categories in Django Admin

2021-08-11 Thread 'Rahul Chauhan' via Django users
Hi All,

I have a category Model like this one which is based on *Adjacency List*.

class Category(models.Model):
name = models.CharField(blank=False, max_length=200)
slug = models.SlugField(null=False)
parent = models.ForeignKey('self', blank=True, null=True, 
related_name='child',on_delete=models.SET_NULL)

I want to display the model has hierarchical/nested structure in the Django 
admin. There are modules available such as TreeBeard or Django-MPTT but I 
dont want to use them.

Tried everything, but unable to achieve the above.

Any help in this direction will be highly appreciated.

Thanks.

-- 
This e-mail is intended only for the named person or entity to which it is 
addressed and contains valuable business information that is privileged, 
confidential and/or otherwise protected from disclosure. If you received 
this e-mail in error, any review, use, dissemination, distribution or 
copying of this e-mail is strictly prohibited. Please notify us immediately 
of the error via e-mail to disclai...@email-abuse.com 
<mailto:disclai...@email-abuse.com> and please delete the e-mail from your 
system, retaining no copies in any media. We appreciate your cooperation.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25736f0b-19e3-4ad2-a774-552774425894n%40googlegroups.com.


Re: Please help me to add button functionality in django admin panel for filter list of objects

2021-08-08 Thread MR INDIA
This article can help 
: 
https://hakibenita.medium.com/how-to-add-custom-action-buttons-to-django-admin-8d266f5b0d41
 

On Thursday, 5 August 2021 at 18:31:52 UTC+5:30 arvind@gmail.com wrote:

> hey guys i want to add the action on click the list will be filter of 
> objects
>
> here the on click of view client task i want to filter task which author 
> type is client
> Here its my try.
>
> *inherit html*
> {% extends 'admin/change_list.html' %}
>
> {% block object-tools %}
> 
> 
> {% csrf_token %}
> View Client Task
> 
>
> 
> 
>
>
>
> *admin.py*
>
>
> *task admin*
> from django.conf.urls import patterns, url
> from django.core.urlresolvers import reverse
> class TaskAdmin(SimpleHistoryAdmin, ExportActionModelAdmin):
> change_list_template = "admin/client_task_change_list.html"
> fieldsets = (
> (
> None,
> {'fields': ('title', 'amount','word','status', 'manager', 'executive', 
> 'assignee','owner','timezone','moved_to_freelancer_portal', 
> 'can_send_without_payment', 
> 'start_date','deadline_soft','deadline_hard','client','team_lead','quality_manager','referencing_style',
>  
> 'tags')}
> ),
> (
> _('Content'),
> {'fields': ('description','author')}
> ),
> (
> _('Tracking'),
> {'fields': ('accepted_by_manager', 'accepted_by_manager_at', 
> 'completed_by_employee', 'completed_by_employee_at',\
>
> 'verified_by_manager','verified_by_manager_at','verified_by_quality','verified_by_quality_at',\
> 'sent_to_client','sent_to_client_at','completed_on')}
> ),
> )
>
> inlines = (PaymentInline,RatingInline,) 
> list_display = ('title', 'status', 'client', 'manager', 'assignee', 
> 'executive', 'team_lead', 
> 'quality_manager','get_payment_status','author','created_at','deadline_soft','deadline_hard','word')
> list_filter = ('status', 'author__type', 
> 'client__clientprofile__email_to_use', OverdueTaskListFilter,('manager', 
> admin.RelatedOnlyFieldListFilter), ('team_lead', 
> admin.RelatedOnlyFieldListFilter), ('quality_manager', 
> admin.RelatedOnlyFieldListFilter),PaymentStatusCategoryListFilter,('deadline_soft',
>  
> DateRangeFilter),('deadline_hard', DateRangeFilter), ('start_date', 
> DateRangeFilter), ('completed_on', DateRangeFilter), AuthorFilter, 
> ('owner', admin.RelatedOnlyFieldListFilter), 'moved_to_freelancer_portal')
> search_fields = ('key', 'title', 'client__username', 'client__email', 
> 'manager__email',)
> date_hierarchy = ('deadline_hard')
> resource_class = TaskResource
>
> # def get_urls(self):
>
> # urls = super(TaskAdmin,self).get_urls()
> # extra_url = patterns('',
> # # url(r'^Client/$',self.get_client_task, 
> name='get_client_task'),#self.admin_site.admin_view(self.do_evil_view))
> # url(r'^client/$',self.admin_site.admin_view(self.get_client_task)),
> # )
> # return urls + extra_url
> # def get_client_task(self, request):
> # # if 'get_client' in request.POST:
> # Task.objects.filter(author__type = UserAccount.LEVEL0)
> # # if self.model.objects.filter(author__type = 
> UserAccount.LEVEL0).exists():
> # self.message_user(request, "Here Its all Clients Tasks")
> # # else:
> # # self.message_user(request, "NO Clients Tasks")
>
> # return reverse('../')
>
> formats = (
> base_formats.CSV,
> base_formats.XLS,
> )
> raw_id_fields = ('author','assignee', 
> 'team_lead','executive','quality_manager', 'manager', 'client', 'owner', 
> 'executive', 'specification')
> history_list_display = ["history_change_reason", "word", 
> "deadline_hard","moved_to_freelancer_portal", "status"]
> #filter_horizontal = ('equipment',)
>
> # def render_change_form(self, request, context, *args, **kwargs):
> # """We need to update the context to show the button."""
> # context.update({'show_client_task': True})
> # return super().render_change_form(request, context, *args, **kwargs)
>
>
> def get_payment_status(self, obj):
> return obj.payment.get_status()
> get_payment_status.short_description = 'Payment'
> def get_queryset(self, request):
> queryset = super(TaskAdmin, self).get_queryset(
> request).annotate(feedback_count=Count('feedback'))
> # if 'get_client' in request.POST:
> # queryset.filter(author__type = UserAccount.LEVEL0)
> # return queryset
> # return queryset
> {{ block.super }}
> {% endblock %}
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a4abd021-7623-4c41-aaa4-ecd35b519b67n%40googlegroups.com.


Re: Django admin filters + select2 + loading many options asynchronously

2021-08-05 Thread Derek
Alternatively, there is 
: https://pypi.org/project/django-admin-autocomplete-filter/ 

(My own issue with that one s that does not necessarily match any custom 
styling, but that is probably not a problem for most.)

On Friday, 6 August 2021 at 07:53:35 UTC+2 Derek wrote:

> You mean like https://pypi.org/project/django-autocomplete-light/ ?
>
> On Wednesday, 4 August 2021 at 20:45:16 UTC+2 Federico Capoano wrote:
>
>> Hi everyone,
>>
>> when adding adming filters by foreign key in the admin, sometimes the 
>> possible values are too many to load.
>>
>> So I am thinking, why not load values asynchronously and show these with 
>> select2?
>> Probably only a certain number of values should be fetched and then while 
>> scrolling more values should be loaded.
>>
>> I am wondering, is there any solution for this already?
>>
>> Thanks in advance
>> Best regards
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04001c01-ae6c-410d-a054-8b4a0c5e6c93n%40googlegroups.com.


Re: Django admin filters + select2 + loading many options asynchronously

2021-08-05 Thread Derek
You mean like https://pypi.org/project/django-autocomplete-light/ ?

On Wednesday, 4 August 2021 at 20:45:16 UTC+2 Federico Capoano wrote:

> Hi everyone,
>
> when adding adming filters by foreign key in the admin, sometimes the 
> possible values are too many to load.
>
> So I am thinking, why not load values asynchronously and show these with 
> select2?
> Probably only a certain number of values should be fetched and then while 
> scrolling more values should be loaded.
>
> I am wondering, is there any solution for this already?
>
> Thanks in advance
> Best regards
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3b5ee45a-85ab-424e-beea-8d66cf5116b3n%40googlegroups.com.


Django admin filters + select2 + loading many options asynchronously

2021-08-04 Thread Federico Capoano
Hi everyone,

when adding adming filters by foreign key in the admin, sometimes the 
possible values are too many to load.

So I am thinking, why not load values asynchronously and show these with 
select2?
Probably only a certain number of values should be fetched and then while 
scrolling more values should be loaded.

I am wondering, is there any solution for this already?

Thanks in advance
Best regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f5c5bd9-d172-41d1-89f2-68b36b3050f5n%40googlegroups.com.


Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread Tree Chip Net
let suppose I have 2 models:
*class String(models.model):*
*string = models.textarea(null = True, blank = True)*
*user = models.ForeignKey(user, on_delete=models.CASCADE)*
*def __str__(self):*
*return self.string*

and


*class Song_Words_Count(models.model):*
*song = models.ForeignKey(user, on_delete=models.SET_NULL)*
*def __str__(self):*
*return self.song*

now what I want to do at django admin side that the string added in
* "String" *model should be saved in Song_Wors_count model and string
should be splitted in a single word and frequency should be counted this
way:

word word_freq
word1 10
word2 15
word3 20

I need Urgent help please.

Em qui, 8 de jul de 2021 18:51, DJANGO DEVELOPER 
escreveu:

> let suppose I have 2 models:
> *class String(models.model):*
> *string = models.textarea(null = True, blank = True)*
> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
> *def __str__(self):*
> *return self.string*
>
> and
>
>
> *class Song_Words_Count(models.model):*
> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
> *def __str__(self):*
> *    return self.song*
>
> now what I want to do at django admin side that the string added in*
> "String" *model should be saved in Song_Wors_count model and string
> should be splitted in a single word and frequency should be counted this
> way:
>
> word word_freq
> word1 10
> word2 15
> word3 20
>
> I need Urgent 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMMKRYzrKLwfJdz4LpmeRG6%2BWRffdADH%3D4_VRC_rOnuw%3DthYSQ%40mail.gmail.com.


Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread DJANGO DEVELOPER
hi Sebastian, do you know how can I resolve my problem? I want to count
same words in a string. after splitting it

On Fri, Jul 9, 2021 at 10:14 PM DJANGO DEVELOPER 
wrote:

> Hi Peter, thanks for your reply. Sorry I have m2m relationship of User
> model with Song model and I am using m2m_changes signal for it but still
> not giving me the desired output.
>
> On Fri, Jul 9, 2021 at 9:20 PM Sebastian Jung 
> wrote:
>
>> Hello Peter,
>>
>> ich would make it with a signal.
>>
>> Here a another example to use a post save signal:
>>
>> from django.db.models.signals import post_savefrom django.dispatch import 
>> receiver
>> class TransactionDetail(models.Model):
>> product = models.ForeignKey(Product)
>> # method for updating@receiver(post_save, sender=TransactionDetail, 
>> dispatch_uid="update_stock_count")def update_stock(sender, instance, 
>> **kwargs):
>> instance.product.stock -= instance.amount
>> instance.product.save()
>>
>>
>> Please write me if you don't understand these example.
>>
>>
>> P.S. i have no idea why you have a foreignkey relation. Why you save words 
>> not in another column in String class?
>>
>> Regards
>>
>>
>> Am Fr., 9. Juli 2021 um 17:30 Uhr schrieb 'Peter van der Does' via Django
>> users :
>>
>>> Overwrite the save method on the String model and when you hit save you
>>> split and save the words in the S_W_C model. This does mean when you update
>>> the String record all the words are added to the S_W_C model as well, as
>>> there is no correlation between the two model you don't know if that String
>>> was already counted.
>>> On 7/8/21 10:26 PM, DJANGO DEVELOPER wrote:
>>>
>>> is there anyone who can help me here?
>>>
>>> On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER 
>>> wrote:
>>>
>>>> let suppose I have 2 models:
>>>> *class String(models.model):*
>>>> *string = models.textarea(null = True, blank = True)*
>>>> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
>>>> *def __str__(self):*
>>>> *return self.string*
>>>>
>>>> and
>>>>
>>>>
>>>> *class Song_Words_Count(models.model):*
>>>> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
>>>> *def __str__(self):*
>>>> *return self.song*
>>>>
>>>> now what I want to do at django admin side that the string added in*
>>>> "String" *model should be saved in Song_Wors_count model and string
>>>> should be splitted in a single word and frequency should be counted this
>>>> way:
>>>>
>>>> word word_freq
>>>> word1 10
>>>> word2 15
>>>> word3 20
>>>>
>>>> I need Urgent 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 view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>>
>>> *Peter van der Does o: **410-584-2500*
>>> * m: 732-425-3102 ONeil Interactive, Inc  oneilinteractive.com
>>> <http://www.oneilinteractive.com/> *
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>

Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread DJANGO DEVELOPER
Hi Peter, thanks for your reply. Sorry I have m2m relationship of User
model with Song model and I am using m2m_changes signal for it but still
not giving me the desired output.

On Fri, Jul 9, 2021 at 9:20 PM Sebastian Jung 
wrote:

> Hello Peter,
>
> ich would make it with a signal.
>
> Here a another example to use a post save signal:
>
> from django.db.models.signals import post_savefrom django.dispatch import 
> receiver
> class TransactionDetail(models.Model):
> product = models.ForeignKey(Product)
> # method for updating@receiver(post_save, sender=TransactionDetail, 
> dispatch_uid="update_stock_count")def update_stock(sender, instance, 
> **kwargs):
> instance.product.stock -= instance.amount
> instance.product.save()
>
>
> Please write me if you don't understand these example.
>
>
> P.S. i have no idea why you have a foreignkey relation. Why you save words 
> not in another column in String class?
>
> Regards
>
>
> Am Fr., 9. Juli 2021 um 17:30 Uhr schrieb 'Peter van der Does' via Django
> users :
>
>> Overwrite the save method on the String model and when you hit save you
>> split and save the words in the S_W_C model. This does mean when you update
>> the String record all the words are added to the S_W_C model as well, as
>> there is no correlation between the two model you don't know if that String
>> was already counted.
>> On 7/8/21 10:26 PM, DJANGO DEVELOPER wrote:
>>
>> is there anyone who can help me here?
>>
>> On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER 
>> wrote:
>>
>>> let suppose I have 2 models:
>>> *class String(models.model):*
>>> *string = models.textarea(null = True, blank = True)*
>>> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
>>> *def __str__(self):*
>>> *return self.string*
>>>
>>> and
>>>
>>>
>>> *class Song_Words_Count(models.model):*
>>> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
>>> *def __str__(self):*
>>> *return self.song*
>>>
>>> now what I want to do at django admin side that the string added in*
>>> "String" *model should be saved in Song_Wors_count model and string
>>> should be splitted in a single word and frequency should be counted this
>>> way:
>>>
>>> word word_freq
>>> word1 10
>>> word2 15
>>> word3 20
>>>
>>> I need Urgent 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>>
>> *Peter van der Does o: **410-584-2500*
>> * m: 732-425-3102 ONeil Interactive, Inc  oneilinteractive.com
>> <http://www.oneilinteractive.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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.com
>> <https://groups.google.com/d/msgid/django-users/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Dj

Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread Sebastian Jung
Hello Peter,

ich would make it with a signal.

Here a another example to use a post save signal:

from django.db.models.signals import post_savefrom django.dispatch
import receiver
class TransactionDetail(models.Model):
product = models.ForeignKey(Product)
# method for updating@receiver(post_save, sender=TransactionDetail,
dispatch_uid="update_stock_count")def update_stock(sender, instance,
**kwargs):
instance.product.stock -= instance.amount
instance.product.save()


Please write me if you don't understand these example.


P.S. i have no idea why you have a foreignkey relation. Why you save
words not in another column in String class?

Regards


Am Fr., 9. Juli 2021 um 17:30 Uhr schrieb 'Peter van der Does' via Django
users :

> Overwrite the save method on the String model and when you hit save you
> split and save the words in the S_W_C model. This does mean when you update
> the String record all the words are added to the S_W_C model as well, as
> there is no correlation between the two model you don't know if that String
> was already counted.
> On 7/8/21 10:26 PM, DJANGO DEVELOPER wrote:
>
> is there anyone who can help me here?
>
> On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER 
> wrote:
>
>> let suppose I have 2 models:
>> *class String(models.model):*
>> *string = models.textarea(null = True, blank = True)*
>> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
>> *def __str__(self):*
>> *return self.string*
>>
>> and
>>
>>
>> *class Song_Words_Count(models.model):*
>> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
>> *def __str__(self):*
>> *return self.song*
>>
>> now what I want to do at django admin side that the string added in*
>> "String" *model should be saved in Song_Wors_count model and string
>> should be splitted in a single word and frequency should be counted this
>> way:
>>
>> word word_freq
>> word1 10
>> word2 15
>> word3 20
>>
>> I need Urgent 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
>
> *Peter van der Does o: **410-584-2500*
> * m: 732-425-3102 ONeil Interactive, Inc  oneilinteractive.com
> <http://www.oneilinteractive.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.com
> <https://groups.google.com/d/msgid/django-users/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKGT9mzRGUFn4%3D29wi%2BZc%2BgosXhpuKMmjXRcefx2ZCnDOoQc4w%40mail.gmail.com.


Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread Tech Cue
 *class String(models.model):*

*string = models.textarea(null = True, blank = True)*
> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
> *def __str__(self):*
> *return self.string*
>
*class Song_Words_Count(models.model):*
> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
>



> *def __str__(self):*
> *return self.song*
>


https://docs.djangoproject.com/en/3.2/topics/db/queries/

On Fri, Jul 9, 2021 at 4:31 PM 'Peter van der Does' via Django users <
django-users@googlegroups.com> wrote:

> Overwrite the save method on the String model and when you hit save you
> split and save the words in the S_W_C model. This does mean when you update
> the String record all the words are added to the S_W_C model as well, as
> there is no correlation between the two model you don't know if that String
> was already counted.
> On 7/8/21 10:26 PM, DJANGO DEVELOPER wrote:
>
> is there anyone who can help me here?
>
> On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER 
> wrote:
>
>> let suppose I have 2 models:
>> *class String(models.model):*
>> *string = models.textarea(null = True, blank = True)*
>> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
>> *def __str__(self):*
>> *return self.string*
>>
>> and
>>
>>
>> *class Song_Words_Count(models.model):*
>> *    song = models.ForeignKey(user, on_delete=models.SET_NULL)*
>> *def __str__(self):*
>> *return self.song*
>>
>> now what I want to do at django admin side that the string added in*
>> "String" *model should be saved in Song_Wors_count model and string
>> should be splitted in a single word and frequency should be counted this
>> way:
>>
>> word word_freq
>> word1 10
>> word2 15
>> word3 20
>>
>> I need Urgent 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
>
> *Peter van der Does o: **410-584-2500*
> * m: 732-425-3102 ONeil Interactive, Inc  oneilinteractive.com
> <http://www.oneilinteractive.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.com
> <https://groups.google.com/d/msgid/django-users/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQGpNnOUgSBL1%2BsK6w3cJuyWw8vgAWzJZq%3D6GPGDjSsOnOLdQ%40mail.gmail.com.


Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-09 Thread 'Peter van der Does' via Django users
Overwrite the save method on the String model and when you hit save you
split and save the words in the S_W_C model. This does mean when you
update the String record all the words are added to the S_W_C model as
well, as there is no correlation between the two model you don't know if
that String was already counted.

On 7/8/21 10:26 PM, DJANGO DEVELOPER wrote:
> is there anyone who can help me here?
>
> On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER
> mailto:abubakarbr...@gmail.com>> wrote:
>
> let suppose I have 2 models:
> *class String(models.model):*
> *    string = models.textarea(null = True, blank = True)*
> *    user = models.ForeignKey(user, on_delete=models.CASCADE)*
> *    def __str__(self):*
> *        return self.string*
>
> and
>
>
> *class Song_Words_Count(models.model):*
> *    song = models.ForeignKey(user, on_delete=models.SET_NULL)*
> *    def __str__(self):*
>     *        return self.song*
>
> now what I want to do at django admin side that the string added
> in*"String" *model should be saved in Song_Wors_count model and
> string should be splitted in a single word and frequency should be
> counted this way:
>
> word word_freq
> word1 10
> word2 15
> word3 20
>
> I need Urgent 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
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com
> 
> <https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> -- 
> 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
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
-- 
*Peter van der Does
o: ***410-584-2500
m: 732-425-3102
*ONeil Interactive, Inc *
oneilinteractive.com <http://www.oneilinteractive.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3921f39e-60d9-0e67-87ff-c8684bafc8f4%40oneilinteractive.com.


Re: Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-08 Thread DJANGO DEVELOPER
is there anyone who can help me here?

On Fri, Jul 9, 2021 at 2:51 AM DJANGO DEVELOPER 
wrote:

> let suppose I have 2 models:
> *class String(models.model):*
> *string = models.textarea(null = True, blank = True)*
> *user = models.ForeignKey(user, on_delete=models.CASCADE)*
> *def __str__(self):*
> *return self.string*
>
> and
>
>
> *class Song_Words_Count(models.model):*
> *song = models.ForeignKey(user, on_delete=models.SET_NULL)*
> *def __str__(self):*
> *return self.song*
>
> now what I want to do at django admin side that the string added in*
> "String" *model should be saved in Song_Wors_count model and string
> should be splitted in a single word and frequency should be counted this
> way:
>
> word word_freq
> word1 10
> word2 15
> word3 20
>
> I need Urgent 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKPY9pkPqSbN0OoxVyQ%2BYcfqq2fRX1NDWqpdyo-KmOG2X_vYeQ%40mail.gmail.com.


Django help| Urgent | how to find the frequency of a string for each word using django admin?

2021-07-08 Thread DJANGO DEVELOPER
let suppose I have 2 models:
*class String(models.model):*
*string = models.textarea(null = True, blank = True)*
*user = models.ForeignKey(user, on_delete=models.CASCADE)*
*def __str__(self):*
*return self.string*

and


*class Song_Words_Count(models.model):*
*song = models.ForeignKey(user, on_delete=models.SET_NULL)*
*def __str__(self):*
*return self.song*

now what I want to do at django admin side that the string added in* 
"String" *model should be saved in Song_Wors_count model and string should 
be splitted in a single word and frequency should be counted this way:

word word_freq
word1 10
word2 15
word3 20

I need Urgent 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f53fc668-ca86-4c51-8d4c-673dee3d180cn%40googlegroups.com.


Re: Django Admin: object history not working

2021-06-23 Thread Christian Ledermann
See
https://stackoverflow.com/questions/987669/tying-in-to-django-admins-model-history
for a better explanation and alternatives

On Tue, 22 Jun 2021 at 18:59, Ryan Kite  wrote:

>
> Thanks for the clarification, I didn't realize it only applied to changes
> administered directly from the Django Admin.
> Was interested in learning about an objects' change history, but in this
> case, the changes were not performed from the Django Admin.
>
>
> On Tuesday, June 22, 2021 at 5:50:10 AM UTC-7 christian...@gmail.com
> wrote:
>
>> I am not sure what you are asking about.
>> The history works out of the box, but only when you manipulate entries
>> via the django admin.
>> When you change the model instance through your own views, you have to
>> explicitly create the log entry.
>>
>> On Tue, 22 Jun 2021 at 00:48, Ryan Kite  wrote:
>>
>>> Hello,
>>>
>>> The issue is when clicking the "History" button on an object from the
>>> Django admin site, it opens to the template but says "*This object
>>> doesn't have a change history. It probably wasn't added via this admin
>>> site."*
>>>
>>> From reading the docs it appears that: *history_view*() already exists
>>> (which is what I want)
>>>
>>> /// from the doc page:
>>> ModelAdmin.history_view(*request*, *object_id*, *extra_context=None*)
>>> [source]
>>> <https://docs.djangoproject.com/en/1.11/_modules/django/contrib/admin/options/#ModelAdmin.history_view>
>>> ¶
>>> <https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.history_view>
>>>
>>>  Django view for the page that shows the modification history for a
>>> given model instance.
>>>
>>> ///
>>>
>>> We can see the change history when doing:
>>>
>>>  python manage.shell
>>>
>>> import django.contrib.admin.models import LogEntry
>>> from django.contrib.contenttypes.models import ContentType
>>> from app import MyModel
>>>
>>>  results =
>>> LogEntry.objects.filter(content_type=ContentType.objects.get_for_model(MyModel
>>> ))
>>>
>>> print(vars(results[1]))
>>>
>>> .. shows the change details
>>>
>>> Please tell me what I'm missing or need to add.
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> Best Regards,
>>
>> Christian Ledermann
>>
>> Dublin, IE
>> Mobile : +353 (0) 899748838
>>
>> https://www.linkedin.com/in/christianledermann
>> https://github.com/cleder/
>>
>>
>> <*)))>{
>>
>> If you save the living environment, the biodiversity that we have left,
>> you will also automatically save the physical environment, too. But If
>> you only save the physical environment, you will ultimately lose both.
>>
>> 1) Don’t drive species to extinction
>>
>> 2) Don’t destroy a habitat that species rely on.
>>
>> 3) Don’t change the climate in ways that will result in the above.
>>
>> }<(((*>
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/cc8975e1-8b77-4316-92df-909eecaad98cn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/cc8975e1-8b77-4316-92df-909eecaad98cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Best Regards,

Christian Ledermann

Dublin, IE
Mobile : +353 (0) 899748838

https://www.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABCjzWq3UhJwtyz%2BQbAaAJg-ganZCr-JL%2BSXLdxrCYOruQ3pqQ%40mail.gmail.com.


Re: Django Admin: object history not working

2021-06-22 Thread Ryan Kite

Thanks for the clarification, I didn't realize it only applied to changes 
administered directly from the Django Admin. 
Was interested in learning about an objects' change history, but in this 
case, the changes were not performed from the Django Admin. 


On Tuesday, June 22, 2021 at 5:50:10 AM UTC-7 christian...@gmail.com wrote:

> I am not sure what you are asking about.
> The history works out of the box, but only when you manipulate entries via 
> the django admin.
> When you change the model instance through your own views, you have to 
> explicitly create the log entry.
>
> On Tue, 22 Jun 2021 at 00:48, Ryan Kite  wrote:
>
>> Hello,
>>
>> The issue is when clicking the "History" button on an object from the 
>> Django admin site, it opens to the template but says "*This object 
>> doesn't have a change history. It probably wasn't added via this admin 
>> site."*
>>
>> From reading the docs it appears that: *history_view*() already exists 
>> (which is what I want)
>>
>> /// from the doc page: 
>> ModelAdmin.history_view(*request*, *object_id*, *extra_context=None*)
>> [source] 
>> <https://docs.djangoproject.com/en/1.11/_modules/django/contrib/admin/options/#ModelAdmin.history_view>
>> ¶ 
>> <https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.history_view>
>>
>>  Django view for the page that shows the modification history for a 
>> given model instance.
>>
>> ///
>>
>> We can see the change history when doing:
>>
>>  python manage.shell
>>
>> import django.contrib.admin.models import LogEntry
>> from django.contrib.contenttypes.models import ContentType
>> from app import MyModel 
>>
>>  results = 
>> LogEntry.objects.filter(content_type=ContentType.objects.get_for_model(MyModel
>>  
>> ))
>>
>> print(vars(results[1])) 
>>
>> .. shows the change details
>>
>> Please tell me what I'm missing or need to add. 
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Best Regards,
>
> Christian Ledermann
>
> Dublin, IE
> Mobile : +353 (0) 899748838
>
> https://www.linkedin.com/in/christianledermann
> https://github.com/cleder/
>
>
> <*)))>{
>
> If you save the living environment, the biodiversity that we have left,
> you will also automatically save the physical environment, too. But If
> you only save the physical environment, you will ultimately lose both.
>
> 1) Don’t drive species to extinction
>
> 2) Don’t destroy a habitat that species rely on.
>
> 3) Don’t change the climate in ways that will result in the above.
>
> }<(((*>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cc8975e1-8b77-4316-92df-909eecaad98cn%40googlegroups.com.


Re: Django Admin: object history not working

2021-06-22 Thread Christian Ledermann
I am not sure what you are asking about.
The history works out of the box, but only when you manipulate entries via
the django admin.
When you change the model instance through your own views, you have to
explicitly create the log entry.

On Tue, 22 Jun 2021 at 00:48, Ryan Kite  wrote:

> Hello,
>
> The issue is when clicking the "History" button on an object from the
> Django admin site, it opens to the template but says "*This object
> doesn't have a change history. It probably wasn't added via this admin
> site."*
>
> From reading the docs it appears that: *history_view*() already exists
> (which is what I want)
>
> /// from the doc page:
> ModelAdmin.history_view(*request*, *object_id*, *extra_context=None*)
> [source]
> <https://docs.djangoproject.com/en/1.11/_modules/django/contrib/admin/options/#ModelAdmin.history_view>
> ¶
> <https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.history_view>
>
>  Django view for the page that shows the modification history for a
> given model instance.
>
> ///
>
> We can see the change history when doing:
>
>  python manage.shell
>
> import django.contrib.admin.models import LogEntry
> from django.contrib.contenttypes.models import ContentType
> from app import MyModel
>
>  results =
> LogEntry.objects.filter(content_type=ContentType.objects.get_for_model(MyModel
> ))
>
> print(vars(results[1]))
>
> .. shows the change details
>
> Please tell me what I'm missing or need to add.
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Best Regards,

Christian Ledermann

Dublin, IE
Mobile : +353 (0) 899748838

https://www.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABCjzWrJZfk%2BTw0yDovv%3DKYu1SiLe3wrk%3DkS-YG%3DeUnpMhbByQ%40mail.gmail.com.


Django Admin: object history not working

2021-06-21 Thread Ryan Kite
Hello,

The issue is when clicking the "History" button on an object from the 
Django admin site, it opens to the template but says "*This object doesn't 
have a change history. It probably wasn't added via this admin site."*

>From reading the docs it appears that: *history_view*() already exists 
(which is what I want)

/// from the doc page: 
ModelAdmin.history_view(*request*, *object_id*, *extra_context=None*)
[source] 
<https://docs.djangoproject.com/en/1.11/_modules/django/contrib/admin/options/#ModelAdmin.history_view>
¶ 
<https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.history_view>

 Django view for the page that shows the modification history for a 
given model instance.

///

We can see the change history when doing:

 python manage.shell

import django.contrib.admin.models import LogEntry
from django.contrib.contenttypes.models import ContentType
from app import MyModel 

 results = 
LogEntry.objects.filter(content_type=ContentType.objects.get_for_model(MyModel 
))

print(vars(results[1])) 

.. shows the change details

Please tell me what I'm missing or need to add. 



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com.


  1   2   3   4   5   6   7   8   9   10   >