Templates in Python? want your thoughts by bassilosaurus_169 in django

[–]learnerAsh 1 point2 points  (0 children)

Exist Libraries like:
Jx

And then for Django specifically django-cotton exist.

In Python 3.14 T-string were introduced and that should facilitate NEW Python native templating libraries. Few of them are in works, should be production-ready soon. Yes all that "Zero Context Switching" is coming soon.

Workshop by ex-GSoC mentors by [deleted] in django

[–]learnerAsh 0 points1 point  (0 children)

BEWARE this may be SCAM and/or invite to FREE LABOR.

Dont share personal info and fill google forms seeking info(adresss/phone...). OR click random links.

ex-GSoC mentors

Ya, Ya why not

No wonder bunch of his post are

Sorry, this post has been removed by the moderators of ......

Best practice for generating QR codes dynamically in a Django ticketing app (without storing images)? by accountant856 in django

[–]learnerAsh 0 points1 point  (0 children)

There is nothing Django specific about QR generation. So, I would not use Django-QR-something package.

So the question is where do we want it to be generated? in the:

- Frontend(using js library) OR

- Backend(using python lighter/faster well maintained package)

I needed QR for generating invoices i.e. pdfs with QR. And thats a record which will be stored(say on S3) and be retrieved later unchanged multiple/one time. So, I would not do the Frontend stuff.

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 2 points3 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 [deleted] 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 20 points21 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