Follows, friends and connection suggestions for DBBasic apps: a social graph module with an admin interface.

0 downloads

dbbasic-follows/QUICKSTART.md
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-follows.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-follows.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-follows.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Initial commit: dbbasic-follows social graph module 85ad7cd 1 year ago History
QUICKSTART.md · 2.4 KB · 127 lines

Quick Start: Create a DBBasic Module in 5 Minutes

1. Copy Template

cp -r module-template dbbasic-contacts
cd dbbasic-contacts

2. Rename Package

# Rename directory
mv dbbasic_module dbbasic_contacts

# Replace "module" with "contacts" in all files
find . -type f -exec sed -i '' 's/dbbasic-module/dbbasic-contacts/g' {} +
find . -type f -exec sed -i '' 's/dbbasic_module/dbbasic_contacts/g' {} +
find . -type f -exec sed -i '' 's/Module/Contacts/g' {} +

# On Linux use: sed -i (without the '')

3. Update Metadata

Edit pyproject.toml:

name = "dbbasic-contacts"
description = "Contact management for DBBasic"
author = "Your Name"
email = "you@example.com"

Edit dbbasic_contacts/admin.py:

ADMIN_CONFIG = [{
    'icon': '👤',
    'label': 'Contacts',
    'href': '/admin/contacts',
    'order': 40
}]

4. Define Fields

Edit dbbasic_contacts/contacts.py, update the schema:

self.schema = {
    'id': int,
    'name': str,
    'email': str,
    'phone': str,
    'company': str,
    'created_at': str,
}

5. Install & Test

pip install -e .
python manage.py serve
open http://localhost:8000/admin/contacts

Done! You now have a working module with admin interface.

What You Get

  • ✅ List view at /admin/contacts
  • ✅ Create form at /admin/contacts/create
  • ✅ Edit form at /admin/contacts/edit/[id]
  • ✅ Delete at /admin/contacts/delete/[id]
  • ✅ Python API: Contacts().create(), .list(), .get(), .update(), .delete()
  • ✅ Automatic menu integration
  • ✅ TSV-based storage

Customize

Add More Fields

Edit dbbasic_contacts/contacts.py:

# Add to schema
self.schema = {
    # ... existing fields ...
    'birthday': str,
    'notes': str,
}

# Add validation in create()
if 'email' not in kwargs:
    raise ValueError("Email required")

Customize List View

Edit dbbasic_contacts/api/contacts/list.py:

  • Change columns in table
  • Add search/filter
  • Customize styling

Add Custom Methods

Edit dbbasic_contacts/contacts.py:

def search_by_company(self, company):
    return self.search(company=company)

def get_by_email(self, email):
    results = self.search(email=email)
    return results[0] if results else None

Publish

python -m build
python -m twine upload dist/*

Now anyone can:

pip install dbbasic-contacts

And they get your module + admin interface automatically!