I really like Django, but I'm not in love with Python. It's nice. D is better.
If you would like to talk about the project, join the official Dlang Discord and ping me (._carter) in either #webdev or #programming.
Personally I won't be using AI assistance for code generation or linting, with perhaps one exception--security. In my view, not augmenting security audits with powerful tools is foolish.
I want to refrain from using AI assistance for code generation and linting because I enjoy programming. I enjoy not knowing and I enjoy figuring it out on my own. I acknowledge that this will make the project take longer. I'm fine with that.
- build
dlangoadminproject. - place
dlango-admin/.exein your path. - create new project:
dlango-admin createproject --name=projectname - As of writing, the generated project does not start a webserver or provide a convenient way for you to add routes (June 25).
- I will fix this tomorrow night.
Dlango uses code-generated database schemas.
struct User {
/// bakes in orm functionality + id field.
mixin Model!User;
string username;
string email;
string password;
long createdAt;
}Once you run makemigrations and migrate, the schema is in place. Migrations are stored in source/migrations/ along with a manifest.
User("retrac", "retrac@gmail.com", "password").save();
auto filtered = User.objects.filter(
Q("email__iexact", "RETRAC@gmail.com"),
Q("username__exact", "retrac")
);
foreach (user; filtered) {
writeln(user.username, " ", user.email, " ", user.ID);
}
// Output: retrac retrac@gmail.com 1As you may have noticed, field lookups are currently very similar to Django field lookups.
exact: Field must exactly match the value.iexact: Case-insensitive exact match (value is lowercased before comparison).contains: Field contains the value (usesLIKE '%value%').gt: Greater than (>).gte: Greater than or equal (>=).lt: Less than (<).lte: Less than or equal (<=).startswith: Field starts with the value (usesLIKE 'value%').endswith: Field ends with the value (usesLIKE '%value').in: Field value must be in a given list (usesIN).isnull: Field must be NULL (usesIS NULL).
Only promise hope is that this will compile with ldc2. DMD has never treated me right.