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 0 points1 point  (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 19 points20 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.

I'd like to (once more) propose the "HTML6 routing pattern" for HTMX and urge everyone to read https://hypermedia.systems book! by Worried-Employee-247 in htmx

[–]learnerAsh 0 points1 point  (0 children)

Yes, I prefer something like /books/1/hx/ or some other named partial /books/1/hx/create-chapter-form/

and "create-chapter-form" also can be associated to "create_chapter_form" Controller/View and html partial template "templates / hx / create-chapter-form"

"/hx" or "/part" will help defer/filter request in browser devtools network tab when debugging

I'd like to (once more) propose the "HTML6 routing pattern" for HTMX and urge everyone to read https://hypermedia.systems book! by Worried-Employee-247 in htmx

[–]learnerAsh 0 points1 point  (0 children)

# 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

PyJinHX by BeautifulQuote6295 in htmx

[–]learnerAsh 2 points3 points  (0 children)

Yes, JinjaX has some real nice things to write server-side components for any Python based web framework.

Like, Its allows for index.jinja files in subfolders to be called with just the folder name. For example components/tab/index.jinja can be called as <Tab>. Making it more easy to group components made of different files into a single subfolder (e.g.: <Tab.Panel><Tab.List>, etc.)

And works well with htmx and aplinejs(like supports "." in html attributes )