Re: Using Admin to manage users that is not in django

2022-03-20 Thread Aldian Fazrihady
Django admin is so coupled to Django models.
Django admin is customizable.

If you want some "integration" with your existing Django admin that is
already linked to your existing models,
you can edit the Django admin index page template and put the link to your
Samba AD DC management page.
Your Samba AD DC management page will be an ordinary Django app.

On Mon, Mar 21, 2022 at 9:52 AM Thiago Luiz Parolin 
wrote:

> Hi.
> I am trying to make a web app to manage samba AD DC.
> Using python bindings from samba, i can access users/groups/features of
> our directory.
> What i want is:
>  - How can i use the django admin to manage AD? Because all the user base
> is inside samba, not in django.
>  - Or i need to build my own 'admin'?
>
> Thanks for any advice.
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/CANbmKytFbGCezptTES%2BqEBebpsVQg0wYrnM129W7jRyR50xSxA%40mail.gmail.com
> 
> .
>


-- 
Regards,

Aldian Fazrihady
http://aldianfazrihady.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/CAN7EoAaYh2H6A_31ehLktAzN7-W%3DTA_0vzqNiWT34nBovMb5Pg%40mail.gmail.com.


Using Admin to manage users that is not in django

2022-03-20 Thread Thiago Luiz Parolin
Hi.
I am trying to make a web app to manage samba AD DC.
Using python bindings from samba, i can access users/groups/features of our
directory.
What i want is:
 - How can i use the django admin to manage AD? Because all the user base
is inside samba, not in django.
 - Or i need to build my own 'admin'?

Thanks for any advice.

-- 
You received this message because you are subscribed to the Google Groups 
"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/CANbmKytFbGCezptTES%2BqEBebpsVQg0wYrnM129W7jRyR50xSxA%40mail.gmail.com.


Re: how to split in multiple file class models.py?

2022-03-20 Thread richard...@gmail.com
Sorry for reviving an old topic, but I have a models.py file that is 
>15,000 lines and would like to chop it up (PyCharm is groaning under the 
weight!).

How would I handle the imports between the chopped-up files in a models 
module where the referenced foreign key model is in a different file?
Is there a risk of circular imports?

Thanks,
Richard Brockie

On Monday, February 1, 2021 at 11:45:25 PM UTC-8 andrea...@hypercode.se 
wrote:

> So,
>
> Boney M's assumption here is correct.
>
> You just need to import all of your models in the __init__.py file using 
> relative imports, so for example:
>
> from .car import Car
>
> and so on.
>
> This works perfectly and I usually try to split the models in that way as 
> not to get a models.py that is over 1 lines long.
>
> Regards,
>
> Andréas
>
>
> Den tis 2 feb. 2021 kl 07:27 skrev Benny M :
>
>> Just a thought, I haven’t tested this: you might be able to trick access 
>> to subdirectories by importing those models in the top-level 
>> models/__init__.py - now that I think about it, you might have to do that 
>> with all the models... so your __init__ file would say something like: 
>>
>> ```
>> from .car import SomeModel
>> from .otherPackage.other_model import SomeOtherModel
>> # and so on ...
>> ``` 
>>
>> Again, I could be way off here. I’ve never looked at the magic that 
>> parses the models on migration creation.
>>
>> Best,
>> Benny
>>
>> On Jan 30, 2021, at 5:44 PM, Manuel  wrote:
>>
>> Hello everyone, I have a question about Django and the use of namespaces 
>> or packages to split the models.py file.
>> I would like to adopt the Java philosophy in which one file corresponds 
>> one class and one db table.
>> I tried to follow this guide, but it doesn’t work.
>>
>> https://docs.djangoproject.com/en/3.1/ref/applications/#namespace-packages-as-apps
>>
>> when I execute this command: "python manage.py makemigrations myapp"
>>
>> Return this warning: "No changes detected in app" 
>>
>> Is it possible to do this structure?
>>
>> /models
>> __init__py # if i use package, or without for namespace
>>  #common import
>> car.py # class car
>> group.py # class group
>> manufactor.py # class manufactor
>> /otherPackage
>> __init__py
>> common import
>> otherClass.py
>>
>> I hope you understand what I’d like to do.
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/6cdc67de-94cb-4ad3-8c73-bc91da02b8bfn%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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CH2PR14MB3913E5B5C52AD6AC35E63C69C0B59%40CH2PR14MB3913.namprd14.prod.outlook.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/4d7d9586-5ff6-4012-aa55-96e9f4ab6a5en%40googlegroups.com.


Tweak admin 'Action' to avoid Cannot call delete() after .distinct()

2022-03-20 Thread Mike Dewhirst
I am using tweaked querysets to populate the Admin and fully understand 
why this error occurs.


I am using Actions to perform bulk operations on selected records so I 
do need the Action selector widget.


How can I remove the 'Delete selected...' option?

Thanks

Mike


 TypeError at /admin/chemical/chemical/

Cannot call delete() after .distinct().

Request Method: POST
Request URL:http://localhost:8088/admin/chemical/chemical/
Django Version: 3.2.12
Exception Type: TypeError
Exception Value:

Cannot call delete() after .distinct().

Exception Location: 
D:\Users\mike\envs\xxai\lib\site-packages\django\db\models\query.py, 
line 728, in delete

Python Executable:  D:\Users\mike\envs\xxai\Scripts\python.exe
Python Version: 3.8.3
Python Path:

['/var/www/aicis',
 'D:\\Users\\mike\\envs\\xxai\\aicis',
 'C:\\Python38\\python38.zip',
 'C:\\Python38\\DLLs',
 'C:\\Python38\\lib',
 'C:\\Python38',
 'D:\\Users\\mike\\envs\\xxai',
 'D:\\Users\\mike\\envs\\xxai\\lib\\site-packages']

--
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/c3867097-88c4-3588-9134-4d2302debf43%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Adding postman generated code to django

2022-03-20 Thread Lakshya Sharma
Hello everyone, django beginner here. I'm trying to build a whatsapp 
chatbot using the documentation here: 
https://api.messengerpeople.dev/docs/authentication I've used postman and 
generated a token and I also notice there was a python code automatically 
generated. Would the next step be to create an authentication app inside my 
project and paste this code inside a function created inside views.py?

-- 
You received this message because you are subscribed to the Google Groups 
"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/3b851426-3e0f-430c-963b-c3dd3dac4296n%40googlegroups.com.


Re: How do detect if template is being viewed on mobile device?

2022-03-20 Thread Django2021
Thanks for your answers. 
Rephrasing question in another thread.


On Thursday, March 17, 2022 at 8:11:10 AM UTC+1 Antonis Christofides wrote:

> Inside of a Django function or template we need to know if to display 
> a landscape or portrait of a form - based on knowing if the viewer is
> using a mobile or not.
>
> Your requirement to know whether you are using "landscape or portrait" is 
> unusual. Normally we are only interested in knowing the width of the 
> screen. If the screen is wide enough, we show the wide version, without 
> caring about what the height of the screen is (it could be a large screen 
> in portrait, for example).
>
> In any case, I think you can solve it with CSS (even if you really want to 
> take the height of the screen into account). This problem has nothing to 
> with Python and Django, it's merely a HTML+CSS issue. If you don't want to 
> learn much CSS, using a CSS framework like Bootstrap can help.
>
> Regards,
>
> Antonis
>
> Antonis Christofides
>
>
>
>
> On 16/03/2022 22.42, Django2021 wrote:
>
> > There are many ways to approach this problem, so it would be best to 
> explain what you are trying to achieve. 
>
> Inside of a Django function or template we need to know if to display 
> a landscape or portrait of a form - based on knowing if the viewer is
> using a mobile or not.
> On Wednesday, March 16, 2022 at 9:34:09 PM UTC+1 Antonis Christofides 
> wrote:
>
>> Hello,
>>
>> there are many ways to approach this problem, so it would be best to 
>> explain what you are trying to achieve.
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofides+30-6979924665 <+30%20697%20992%204665> (mobile)
>>
>>
>> On 16/03/2022 22.28, Django2021 wrote:
>>
>>
>> With Django how is it possible to detect 
>> * if template is being viewed on mobile device?
>> and/or 
>> * if template is being viewed in portrait or landscape mode? 
>>
>> Any suggestions appreciated.
>>
>>
>> -- 
>> You received this message because you are subscribed 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/7be1145e-662e-4d57-afa6-b9d178f7fb0fn%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...@googlegroups.com.
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/83a4a51d-6913-47ce-a5da-f49f4b3d72abn%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/886527f7-3750-4d93-b119-1b75bce8609cn%40googlegroups.com.


Re: How do detect if template is being viewed on mobile device?

2022-03-20 Thread Django2021
> This problem has nothing to with Python and Django, it's merely a 
HTML+CSS issue. 

While I realize the roots of this issue are in HTML+CSS  for me and likely 
many others it is a 
Django template issue. 

I've experimented with Bootstrap, Javascript, HTML and CSS 'solutions' yet 
find many of these solutions 
lacking in the areas of cross platform compatibility, and portability. 

I'll rephrase my question on another thread hoping it will draw some 
comparative discussion
in the area of what methods others are using for determining screen 
dimensions as it 
relates to formatting of of Django templates.


On Thursday, March 17, 2022 at 8:11:10 AM UTC+1 Antonis Christofides wrote:

> Inside of a Django function or template we need to know if to display 
> a landscape or portrait of a form - based on knowing if the viewer is
> using a mobile or not.
>
> Your requirement to know whether you are using "landscape or portrait" is 
> unusual. Normally we are only interested in knowing the width of the 
> screen. If the screen is wide enough, we show the wide version, without 
> caring about what the height of the screen is (it could be a large screen 
> in portrait, for example).
>
> In any case, I think you can solve it with CSS (even if you really want to 
> take the height of the screen into account). This problem has nothing to 
> with Python and Django, it's merely a HTML+CSS issue. If you don't want to 
> learn much CSS, using a CSS framework like Bootstrap can help.
>
> Regards,
>
> Antonis
>
> Antonis Christofides
>
>
>
>
> On 16/03/2022 22.42, Django2021 wrote:
>
> > There are many ways to approach this problem, so it would be best to 
> explain what you are trying to achieve. 
>
> Inside of a Django function or template we need to know if to display 
> a landscape or portrait of a form - based on knowing if the viewer is
> using a mobile or not.
> On Wednesday, March 16, 2022 at 9:34:09 PM UTC+1 Antonis Christofides 
> wrote:
>
>> Hello,
>>
>> there are many ways to approach this problem, so it would be best to 
>> explain what you are trying to achieve.
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofides+30-6979924665 <+30%20697%20992%204665> (mobile)
>>
>>
>> On 16/03/2022 22.28, Django2021 wrote:
>>
>>
>> With Django how is it possible to detect 
>> * if template is being viewed on mobile device?
>> and/or 
>> * if template is being viewed in portrait or landscape mode? 
>>
>> Any suggestions appreciated.
>>
>>
>> -- 
>> You received this message because you are subscribed 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/7be1145e-662e-4d57-afa6-b9d178f7fb0fn%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...@googlegroups.com.
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/83a4a51d-6913-47ce-a5da-f49f4b3d72abn%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/9ec977ef-09f4-4691-908c-d2a789e8759an%40googlegroups.com.