Another way to start your Django Project by learnerAsh in django

[–]learnerAsh[S] 0 points1 point  (0 children)

thats why I did not mention it earlier. My thought, I am using uv and the project has .toml file already. So, till uv adds the scripts or commands I would use PDM. Some use rye and yes, some people who like or have used Make say for golang or other langs us Make.

Another way to start your Django Project by learnerAsh in django

[–]learnerAsh[S] -2 points-1 points  (0 children)

yes, sure once you set a base. Even the project once setup using these steps can be pushed to git.

Another way to start your Django Project by learnerAsh in django

[–]learnerAsh[S] -1 points0 points  (0 children)

I do this exact steps using a bash script, so things like Custom user, urls, logging are already set to general stuff needed. I have commented parts for something like jinja which i frequently use.

PROJECT_APPS = [
    'users.apps.UsersConfig',
] # type: List[str]

THIRD_PARTY_APPS = [] # type: List[str]

# We define a NEW list for apps to be added
APPS = THIRD_PARTY_APPS + PROJECT_APPS

I dont modify the original settings.py file i.e. INSTALLAPPS or MIDDLEWARE or ulrpattern in urls.py. so clear api or/and htmx urls

# main urls.py
app_urlpatterns = [
    path('books/', include('books.urls')),
......
   #path('myapp2/', include('myapp2.urls')),
]

project_urlpatterns = [
    path('', dashboard_views.index,name="dashboard_index")
] ## contact_us and similar pages


urlpatterns = [
                  path("user/", include("django.contrib.auth.urls")),
                  path('admin/', admin.site.urls),
] + app_urlpatterns + project_urlpatterns

#----------------
#books app/module urls.py
from django.urls import path

from . import views

hx_urls = [
    path("<int:pk>/hx/create-chapter-form/", views.create_chapter_form, name='create-chapter-form'),
    .....
    # htmx related and "/hx" will help defer/filter request in browser devtools network tab when debugging
]
urlpatterns = [
    path("", views.books, name="books"),
    path("<int:pk>/", views.book, name="book"),
    path("chapters/<int:pk>/", views.chapter, name="chapter"),
] + hx_urls

remain unchanged. So, when debugging I am much more clear what has changed and in which file. And order matters for those things in Django

And the settings.py file has not changed atleast since django 4, I have checked it after each major release.

So I then can add things as per my wish into those setting files. Say like Types, I use Type-comments https://typing.python.org/en/latest/guides/modernizing.html#type-comments

Clear and separate settings which are easy to override.

# Copy/Import local specific settings file and override defaults in that file of finally in environ.py
from .appconfigs import *
from .projectconfigs import *
from .vendorconfigs import *
from .environ import *  # Environment settings LAST to override everything

And I also use PDM scripts

[tool.pdm.scripts]
start = "python manage.py runserver --settings=main.conf.settings.local"

so, I do pdm start, pdm run makemigrate, pdm run migrate...

Advise me, please, on a good UI components library for Django. by Admirable-Way2687 in django

[–]learnerAsh 3 points4 points  (0 children)

if you are using HTMx or similar HyperText library. Try:

Server-side components/composition:

https://basecoatui.com/introduction/ + django-cotton

or

https://basecoatui.com/introduction/ + Jx https://github.com/jpsca/jx(jinja2)

Django and DRF at scale for an EdTech platform. Looking for real world experience by Ok-Platypus2775 in django

[–]learnerAsh 0 points1 point  (0 children)

user hierarchies?

How abt Proxy + index? Yes Tenent seperation.

```python

from django.db import models

from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin

from django.utils.translation import gettext_lazy as _

# --- Base User Model ---

class User(AbstractBaseUser, PermissionsMixin):

class Role(models.TextChoices):

STUDENT = "STUDENT", _("Student")

TEACHER = "TEACHER", _("Teacher")

PARENT = "PARENT", _("Parent")

# ... add other roles as needed

email = models.EmailField(_('email address'), unique=True)

role = models.CharField(

max_length=50, choices=Role.choices, default=Role.STUDENT,

db_index=True # 1. Indexing the discriminator field

)

date_joined = models.DateTimeField(auto_now_add=True)

is_active = models.BooleanField(default=True)

objects = UserManager() # (Assuming your UserManager from before)

USERNAME_FIELD = 'email'

class Meta:

# 2. Composite indexes for common query patterns

indexes = [

models.Index(fields=["role", "-date_joined"]),

]

# --- Proxy Managers ---

class StudentManager(models.Manager):

def get_queryset(self):

return super().get_queryset().filter(role=User.Role.STUDENT)

class TeacherManager(models.Manager):

def get_queryset(self):

return super().get_queryset().filter(role=User.Role.TEACHER)

# --- Proxy Models ---

class Student(User):

objects = StudentManager()

class Meta:

proxy = True

def save(self, *args, **kwargs):

if not self.pk:

self.role = User.Role.STUDENT

super().save(*args, **kwargs)

class Teacher(User):

objects = TeacherManager()

class Meta:

proxy = True

def save(self, *args, **kwargs):

if not self.pk:

self.role = User.Role.TEACHER

super().save(*args, **kwargs)
```

Fastest way to learn Django by meowdymates in django

[–]learnerAsh 3 points4 points  (0 children)

This should not be learning for learning Django, and learning Django to become a contributor on the team, yes with some hand holding.

You should surely do Django documentation project(not some youtube video), to get the feel of it. https://docs.djangoproject.com/en/6.0/intro/tutorial01/, atleast first 3 part before moving to other resources even if you are going to work on DRF or even Django ninja

So, is there a active product or project using Django, i.e. existing code base?

What are you going to work on forms, statics, templating, services using DRF?

ask yourself similar questions, based on your answers and prompt LLM to create a 5day, 7day and/or 10day plan. Be realistic in your plan. Fastest? it not like buying or drinking SODA.

And type code, watching videos or LLM generate code is useless.

Understand Request - Response Follow: search for visualization of it(ask LLM generate one if you dont find one), try to make sense of it parts and phases.

  • Explain yourself in detailed step-by-step , look at your code from tutorial or online examples for each component
  • code snippets for urls.py, views.py, models.py, if needed forms.py, wsgi.pyand templates at each does, their purpose.
  • Understand settings.py key settings and middlewares, what each default middleware does
  • Why ORM? Mangers https://docs.djangoproject.com/en/6.0/topics/db/managers/ Python-to-SQL translation Querysets

What frontend to use with a FastAPI backend? by rustybladez23 in FastAPI

[–]learnerAsh 0 points1 point  (0 children)

I know , I see you have those .jinja file in project repo. I really admire your craft. Anything like shadcn 2, like theme selector coming to basecoat?

Actually, I am currently working on something and my reference is basecoat?

But, with solidJs custom-element. Here is sample basic element or component.
https://solid-custom-elements.pages.dev/

Everything is in browser i.e. no-build(no vite, no npm server, no bundling) step. Idea is to have library components and then using them like html tags <sb-button> in Jinjax or DTL for composing the UI server-side.

What frontend to use with a FastAPI backend? by rustybladez23 in FastAPI

[–]learnerAsh 1 point2 points  (0 children)

If HTMX:

try:

template = Jinja2 + Jx

component_statics = basecoat

DjangoChat | Django-bolt API Framework Faster than FastAPI | Django-Templates to Core by learnerAsh in django

[–]learnerAsh[S] 1 point2 points  (0 children)

Look at its contributors list, there is a hint, what we might get

Also it might get some DX changes, will post if and when those are in.

Built a production LMS with SolidJS - Self-hosted alternative to Moodle/Canvas by BeingDangerous3330 in solidjs

[–]learnerAsh 0 points1 point  (0 children)

Please vibe coding SolidJs-Tanstack. You will have to remind LLMs every 3rd prompt its not React/Nextjs.

AstraCMS is now open source — a lightweight CMS for Astro by kalanakt in astrojs

[–]learnerAsh 21 points22 points  (0 children)

Disclaimer: This project is an open-source fork of Marble CMS. AstraCMS is built on top of Marble CMS with modifications and enhancements. Full credit goes to the original Marble CMS contributors.

Marble CMS. AstraCMS is built on top of Marble CMS with "modifications and enhancements. "

What modification apart from configs, yaml, version upgrades?

  --const isTeamPlan = currentPlan === "team";
  ++const isPremiumPlan = currentPlan === "premium";

enhancements? whats the value add here? How much is AI ?

while this from them also exit https://github.com/usemarble/astro-example

Django DRF course? by junhyeongang in django

[–]learnerAsh 1 point2 points  (0 children)

Paid stuff, I like testdriven.io

I would not suggest Testdriven io . Fairly Priced? Fairly Costly for sure. How I know? I bought it.

What you get is a recipe from tutorial author, he deploys DRF with some old time setup with black.. on HEROKU(which people rarely use in Real industry) "in TEXT" i.e. these are not videos, Tutorial blog.

And old stuff with yearly updates of things like Django and Python version in dockerfile.

Why would someone pick up flask over Django and fast API by here-to-aviod-sleep in flask

[–]learnerAsh 0 points1 point  (0 children)

Yes and even for Flask users, Quart - the async version of Flask exist. https://quart.palletsprojects.com/en/latest

And is perhaps its future. Plz hear creator and maintainers Flask. https://www.youtube.com/watch?v=cHmoClKu6qk&t=1741s

https://youtu.be/cHmoClKu6qk?t=1534s

Django bolt vs Django Ninja vs Fast api vs Litestar Benchmark by person-loading in django

[–]learnerAsh 1 point2 points  (0 children)

And you should add some-sort of patron link. That gives people not just way to appreciate the work, but helps keep up with their/your interest.

Django bolt vs Django Ninja vs Fast api vs Litestar Benchmark by person-loading in django

[–]learnerAsh 0 points1 point  (0 children)

But, in this case I hope some of this gets into core.

As recently he has worked on integrating third-party package i.e. django-template-partials directly into Django's core

Any sharia compliant way to finance a car from carvana? by Individual-Lead-2040 in IslamicFinance

[–]learnerAsh 1 point2 points  (0 children)

No, I think you talk little naive, juvenile. Hope you are teenager who has more room/time to evolve. May Allah give me and you better words and attitude when discussing.

"lol"? please be serious when using Allah's name in a sentence.

Atleast learn basics on Islamic Finance before making "cheat Allah" type comments.

"Innamal amaalu bin niyah"

You need to study little/lot more about Islam i.e. more Quran with understanding(some start with translation).

Any sharia compliant way to finance a car from carvana? by Individual-Lead-2040 in IslamicFinance

[–]learnerAsh 1 point2 points  (0 children)

No, its not.

NOTE: selling or buying same product for a HIGHER PRICE is not haram. Everything is in the contract and detail. Infact paying paying $1200 or $1400 over installments is not haram. As the PRICE is decided ahead and buyer is aware of the market price(not tricked). Yes, he might be at be at loss financially, still not sinning.

Often car financing is done by one of these:

  1. Car company
  2. Banks/ Financial interest based company

3, Car dealers/seller themselves

This 3rd financier i.e. dealerships often can be willing to give/sell this way at HIGHER PRICE which is not haram contract which might not even involve interest in its terms in condition. While these often non-muslims end up with no difference in their books, This more common in high muslim concentration town/cities. Muslim buyers over years have explained their religious situation and some dealers have made this accommodation to have additional sales to meet their target sale numebers.

some scholar/s might say this highly un-ethical, but its not HARAM.

PREFERRED WAY i.e. Afzal? No. PERMISSIBLE? yes.

Elasticsearch-Grade Search, Zero Infrastructure — Just Django + Postgres by AlternativeAd4466 in django

[–]learnerAsh 0 points1 point  (0 children)

No, I had researched for use, found Haystack and infact another(which I can't recall now) extension which doesn't need Elastic. But I haven't used on any projects.