{"id":24795,"library":"urlman","title":"urlman","description":"A Python library providing a declarative way to build URL patterns for Django models, similar to Django REST Framework's reverse patterns but more general. Current version 2.0.3, with a focus on simplicity and type safety. Release cadence is low; the library is in maintenance mode.","status":"active","version":"2.0.3","language":"python","source_language":"en","source_url":"https://github.com/andrewgodwin/urlman","tags":["django","urls","patterns","reverse"],"install":[{"cmd":"pip install urlman","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"Runtime dependency for model URL generation","package":"django","optional":false}],"imports":[{"note":"Main class for defining URL patterns","wrong":null,"symbol":"Urls","correct":"from urlman import Urls"}],"quickstart":{"code":"from django.db import models\nfrom urlman import Urls\n\nclass MyModel(models.Model):\n    name = models.CharField(max_length=100)\n\n    class urls(Urls):\n        detail = '/{self.pk}/'\n        edit = '/{self.pk}/edit/'\n\ninst = MyModel(pk=1, name='test')\nprint(inst.urls.detail)  # '/1/'\nprint(inst.urls.edit)    # '/1/edit/'\n","lang":"python","description":"Define URL patterns as a nested Urls class on your Django model."},"warnings":[{"fix":"Update imports to 'from urlman import Urls'.","message":"In version 2.0, the import path changed: previously you could import from urlman.urls directly. Now all public API is from 'urlman'.","severity":"breaking","affected_versions":"<2.0"},{"fix":"Remove 'name' argument; use the method name as the URL name.","message":"The 'name' argument when defining url patterns is deprecated; instead use explicit class methods or properties to generate named URLs.","severity":"deprecated","affected_versions":">=1.4, <2.1"},{"fix":"Define methods that return strings; they are automatically treated as properties by urlman.","message":"Do NOT use the @property decorator on methods within the Urls class. urlman handles access like attributes automatically.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Define 'class urls(Urls):' inside your model, not 'class Urls(Urls):'.","cause":"The Urls class must be defined as a class attribute named 'urls' (lowercase) on the model.","error":"AttributeError: 'MyModel' object has no attribute 'urls'"},{"fix":"Use inst.urls.detail, not inst.urls().","cause":"Trying to call inst.urls() instead of accessing it as an attribute.","error":"TypeError: 'Urls' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}