Giter Club home page Giter Club logo

dj-shop-cart's Introduction

Banner

Hello there, I'm Tobi πŸ‘‹πŸΎ

web email twitter polywork devto hashnode spotify

Welcome to my GitHub bio. I'm a software engineer, open-source contributor, and occasional blogger. I spend my days building full-stack applications and tools in Python, and some of the technologies I work with include AWS, Django, HTMX, Tailwind CSS, Docker, and occasionally FastAPI (async Python has piqued my interest).

  • πŸ”­ Currently diving into Elixir.
  • πŸ‘― Open to new work and collaboration opportunities.
  • ✍️ I express my thoughts through writing to refine my ideas.
  • 🧠 You'll often find me digging into my second-brain folder on my laptopβ€”it's a handy resource!
  • πŸ”Š Music enthusiast with a taste for Pop, Modern Rock, J-pop, and more.

Here are a few projects I'm currently working on that might be of interest to you:

  • falco: Enhance your Django developer experience: CLI and Guides for the Modern Django Developer.
  • cookiecutter-fastapi: Cookiecutter fastapi is a framework for jumpstarting production-ready fastapi projects quickly.
  • litestar-tailwind-cli: Provides a CLI plugin for Litestar to use Tailwind CSS via the Tailwind CLI.
  • litestar-browser-reload: Automatic browser reload plugin for Litestar, designed for development use.
  • dj-shop-cart: A simple and flexible cart manager for your django projects.
  • leerming: An implementation of the Leitner box that can generate flashcards using llms from documents, youtube videos and web page links.
  • sse-relay-server: An SSE Relay Service: Perfect for Adding Real-Time Features to Your Django Project Without Introducing ASGI or Async Code.
  • htmx_extensions: A registry of htmx extensions, both official and third-party.

To see my full list of noteworthy projects, visit: My Projects.

My latest publications:

read more...

Current Languages and tools

My Skills

Language and Tools to Learn

To Learn


⚑ Github Stats


⚑ Recent Github Activity

Last Updated: Wednesday, June 19th, 2024, 4:21:04 AM

  1. ⬆️ Pushed 1 commit(s) to Tobi-De/qosic-sdk
  2. ⬆️ Pushed 1 commit(s) to Tobi-De/qosic-sdk
  3. ⬆️ Pushed 1 commit(s) to Tobi-De/qosic-sdk
  4. ⬆️ Pushed 1 commit(s) to Tobi-De/qosic-sdk
  5. ⬆️ Pushed 1 commit(s) to Tobi-De/qosic-sdk

πŸ˜„ Need a stress-reliever? Find some laughs at grugbrain.dev.

dj-shop-cart's People

Contributors

aimedey19 avatar dependabot[bot] avatar tobi-de avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dj-shop-cart's Issues

Async support

I was wondering if this module could support async after some changes. If so, would it be a good first issue for beginners like me?

add non django models

something I did for an old project

import json
import uuid
from dataclasses import asdict, dataclass
from decimal import Decimal

from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist

# fixme this is a really nasty solution, will probably need to fix this or update dj_shop_cart to support such use case


def gen_pk() -> str:
    return str(uuid.uuid4())


@dataclass(slots=True)
class FakeManager:
    def get(self, pk: str):
        data = cache.get(pk)
        if not data:
            raise ObjectDoesNotExist("Item no longer available in the cache")
        return FakeProduct(**json.loads(data))


@dataclass(slots=True)
class FakeProduct:
    """
    Ok, this is the issue
    dj_shop_cart cart is used to manage the "cart" when creating expenses and revenues.
    I required a django model instance as the product being added to the cart, the issue is that to add item
    to the expense card you don't need an item store in the database (a django model), a line item can
    be added with or without a db product, so the plan here is to use this class to emulate what dj_shop_cart
    need and expect from a django model to store item without a db product
    """

    label: str
    price: str
    objects = FakeManager()

    def __str__(self):
        return self.label

    def __post_init__(self):
        self.price = str(self.price)
        cache.set(key=self.pk, value=json.dumps(asdict(self)), timeout=60 * 60)

    @property
    def pk(self):
        return hash(self.label.lower())

    def get_price(self, *args, **kwargs):
        return Decimal(self.price)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.