mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 19:42:37 +02:00
72 lines
No EOL
3.2 KiB
HTML
72 lines
No EOL
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<title>
|
|
urls - Alexis Métaireau </title>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet"
|
|
href="https://blog.notmyidea.org/theme/css/main.css?v2"
|
|
type="text/css" />
|
|
<link href="https://blog.notmyidea.org/feeds/all.atom.xml"
|
|
type="application/atom+xml"
|
|
rel="alternate"
|
|
title="Alexis Métaireau ATOM Feed" />
|
|
</head>
|
|
<body>
|
|
<div id="content">
|
|
<section id="links">
|
|
<ul>
|
|
<li>
|
|
<a class="main" href="/">Alexis Métaireau</a>
|
|
</li>
|
|
<li>
|
|
<a class=""
|
|
href="https://blog.notmyidea.org/journal/index.html">Journal</a>
|
|
</li>
|
|
<li>
|
|
<a class=""
|
|
href="https://blog.notmyidea.org/code/">Code, etc.</a>
|
|
</li>
|
|
<li>
|
|
<a class=""
|
|
href="https://blog.notmyidea.org/weeknotes/">Notes hebdo</a>
|
|
</li>
|
|
<li>
|
|
<a class=""
|
|
href="https://blog.notmyidea.org/lectures/">Lectures</a>
|
|
</li>
|
|
<li>
|
|
<a class=""
|
|
href="https://blog.notmyidea.org/projets.html">Projets</a>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<h1>
|
|
Tag « urls » </h1>
|
|
<section class="section index">
|
|
<time datetime="2024-02-22T00:00:00+01:00">22 février 2024</time> <a class='tag' href="https://blog.notmyidea.org/tag/django.html">django</a>
|
|
, <a class='tag' href="https://blog.notmyidea.org/tag/urls.html">urls</a>
|
|
, <a class='tag' href="https://blog.notmyidea.org/tag/uuid.html">uuid</a>
|
|
<h1>
|
|
<a href="https://blog.notmyidea.org/using-uuids-in-urls-in-a-django-app.html" id="page-title">Using uuids in URLs in a Django app</a>
|
|
</h1>
|
|
<p>After adding a regexp for uuids (which are quite hard to regexp for), I
|
|
discovered that Django <a href="https://docs.djangoproject.com/
|
|
en/5.0/topics/http/urls/#path-converters">offers path converters</a>, making this a piece of cake.</p>
|
|
<p>I was using old school <code>re_path</code> paths in my <code>urls.py</code>, but it’s possible to
|
|
replace them with <code>path</code>, like this:</p>
|
|
<div class="highlight"><pre><span></span><code><span class="n">url_patterns</span> <span class="o">=</span> <span class="p">(</span>
|
|
<span class="n">path …</span></code></pre></div>
|
|
</section>
|
|
<ul>
|
|
</ul>
|
|
</section>
|
|
<footer>
|
|
<a id="feed" href="/feeds/all.atom.xml">
|
|
<img alt="RSS Logo" src="/theme/rss.svg" />
|
|
</a>
|
|
</footer>
|
|
</div>
|
|
</body>
|
|
</html> |