RE: Splitting views.py and urls.py into a directory rather than single files

2023-09-18 Thread Mike Dewhirst
I like the following method because it lets me start a project with a single 
file of views per app and then later when it grows, split it into named files 
in a 'views' directory - without needing to adjust other code which imports 
them.1. Create a views directory in the app dir2. Create __init__.py in the new 
directory3. Move the monster views.py into ./views renaming it to original.py 
or something similar.4. Split original.py into as many useful individual views 
files as desired - including separate utilities file(s) etc.5. In __init__.py 
import each view used by your urls.py using lines like ...   from .filename 
import ViewNameObviously, multiple views can be grouped into the same file so 
long as they are imported into views.__init__.py6. In urls.py you can then say 
...    import appname.views as appname_views... if that's not what you do 
already!--(Unsigned mail from my phone)
 Original message From: 'Simon Connah' via Django users 
 Date: 18/9/23  22:27  (GMT+10:00) To: 
django-users@googlegroups.com Subject: Splitting views.py and urls.py into a 
directory rather than single files Hi,I have an app which has a lot of views 
and URLs and keeping them in just one file makes it really hard to manage 
because it is so long. I'd like to make a views and URLs folder which will 
allow me to break up views and URLs into different categories but I'm not sure 
what the best way to go about doing that is.Can someone point me in the right 
direction please?Thank you!Simon.-- You received this message because you are 
subscribed 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/4svI0xN0uu53BvHzhG9Aa1qvI61v1qPlQOhkOLpaJPRXX1Jysfu-BOmrFlBsDOfHfKRHwTaXJNmKFApZ1W13jQLdpVvXQDEPdWq87T-ILR8%3D%40protonmail.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/6508e58d.0c0a0220.6ef59.78b3SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Django 5.0 alpha 1 released

2023-09-18 Thread Natalia Bidart
Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2023/sep/18/django-50-alpha-1-released/

This is my first alpha release, so let me know if you see something odd!

Cheers, Natalia.

-- 
You received this message because you are subscribed 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/CA%2BfOnFYxgPkkn1CkPeuvm2TgbZv87PzkaVYf5bzooYSoJzMuPA%40mail.gmail.com.


Re: Splitting views.py and urls.py into a directory rather than single files

2023-09-18 Thread Asim Sulehria
You are welcome

On Mon, Sep 18, 2023 at 6:00 PM 'Simon Connah' via Django users <
django-users@googlegroups.com> wrote:

> Thank you! That got it working!
>
> --- Original Message ---
> On Monday, September 18th, 2023 at 13:34, Asim Sulehria <
> de.asimha...@gmail.com> wrote:
>
> You can just directly declare an array of URL Patterns in a separate file
> and then import that file in the url files you want to make the main urls
> file
>
> On Mon, Sep 18, 2023 at 5:28 PM 'Simon Connah' via Django users <
> django-users@googlegroups.com> wrote:
>
>> Hi,
>>
>> I have an app which has a lot of views and URLs and keeping them in just
>> one file makes it really hard to manage because it is so long. I'd like to
>> make a views and URLs folder which will allow me to break up views and URLs
>> into different categories but I'm not sure what the best way to go about
>> doing that is.
>>
>> Can someone point me in the right direction please?
>>
>> Thank you!
>>
>> Simon.
>>
>> --
>> You received this message because you are subscribed 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/4svI0xN0uu53BvHzhG9Aa1qvI61v1qPlQOhkOLpaJPRXX1Jysfu-BOmrFlBsDOfHfKRHwTaXJNmKFApZ1W13jQLdpVvXQDEPdWq87T-ILR8%3D%40protonmail.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/CAPz57eGK6EXPGObGH5-ej3OPGvEmox%2BkR34xW3Eg1weWQug%3Dcw%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/d3_jwrhlaNWhn-_QfIOhopznbSi5o3e5tF5p-pF34iqaGFRRBVFScOg6PL95XWeJIBV6JpmQpXg0L0FcGNH9fjM5CItLGCZ8mIoJqNxEohU%3D%40protonmail.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/CAPz57eEjaHPPkZPNfVONt%3D%2B4pH8OwUuCit%3DoL9N0swRPRO2Qhg%40mail.gmail.com.


Re: Splitting views.py and urls.py into a directory rather than single files

2023-09-18 Thread 'Simon Connah' via Django users
Thank you! That got it working!


--- Original Message ---
On Monday, September 18th, 2023 at 13:34, Asim Sulehria 
 wrote:


> You can just directly declare an array of URL Patterns in a separate file and 
> then import that file in the url files you want to make the main urls file
> 

> On Mon, Sep 18, 2023 at 5:28 PM 'Simon Connah' via Django users 
>  wrote:
> 

> > Hi,
> > 

> > I have an app which has a lot of views and URLs and keeping them in just 
> > one file makes it really hard to manage because it is so long. I'd like to 
> > make a views and URLs folder which will allow me to break up views and URLs 
> > into different categories but I'm not sure what the best way to go about 
> > doing that is.
> > 

> > Can someone point me in the right direction please?
> > 

> > Thank you!
> > 

> > Simon.
> > 

> > --
> > You received this message because you are subscribed 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/4svI0xN0uu53BvHzhG9Aa1qvI61v1qPlQOhkOLpaJPRXX1Jysfu-BOmrFlBsDOfHfKRHwTaXJNmKFApZ1W13jQLdpVvXQDEPdWq87T-ILR8%3D%40protonmail.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/CAPz57eGK6EXPGObGH5-ej3OPGvEmox%2BkR34xW3Eg1weWQug%3Dcw%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/d3_jwrhlaNWhn-_QfIOhopznbSi5o3e5tF5p-pF34iqaGFRRBVFScOg6PL95XWeJIBV6JpmQpXg0L0FcGNH9fjM5CItLGCZ8mIoJqNxEohU%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Re: Splitting views.py and urls.py into a directory rather than single files

2023-09-18 Thread Asim Sulehria
You can just directly declare an array of URL Patterns in a separate file
and then import that file in the url files you want to make the main urls
file

On Mon, Sep 18, 2023 at 5:28 PM 'Simon Connah' via Django users <
django-users@googlegroups.com> wrote:

> Hi,
>
> I have an app which has a lot of views and URLs and keeping them in just
> one file makes it really hard to manage because it is so long. I'd like to
> make a views and URLs folder which will allow me to break up views and URLs
> into different categories but I'm not sure what the best way to go about
> doing that is.
>
> Can someone point me in the right direction please?
>
> Thank you!
>
> Simon.
>
> --
> You received this message because you are subscribed 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/4svI0xN0uu53BvHzhG9Aa1qvI61v1qPlQOhkOLpaJPRXX1Jysfu-BOmrFlBsDOfHfKRHwTaXJNmKFApZ1W13jQLdpVvXQDEPdWq87T-ILR8%3D%40protonmail.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/CAPz57eGK6EXPGObGH5-ej3OPGvEmox%2BkR34xW3Eg1weWQug%3Dcw%40mail.gmail.com.


Splitting views.py and urls.py into a directory rather than single files

2023-09-18 Thread 'Simon Connah' via Django users
Hi,

I have an app which has a lot of views and URLs and keeping them in just one 
file makes it really hard to manage because it is so long. I'd like to make a 
views and URLs folder which will allow me to break up views and URLs into 
different categories but I'm not sure what the best way to go about doing that 
is.

Can someone point me in the right direction please?

Thank you!

Simon.

-- 
You received this message because you are subscribed 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/4svI0xN0uu53BvHzhG9Aa1qvI61v1qPlQOhkOLpaJPRXX1Jysfu-BOmrFlBsDOfHfKRHwTaXJNmKFApZ1W13jQLdpVvXQDEPdWq87T-ILR8%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature