---
slug: "Djangoadminは、GETで渡ってきたパラメータをフォームフィールドのデフォルト値にする"
title: "Django admin sets default form field values based on GET parameters"
description: "\n\n\nWhen you pass a GET query like"
url: "https://www.ytyng.com/en/blog/Djangoadminは、GETで渡ってきたパラメータをフォームフィールドのデフォルト値にする"
publish_date: "2011-06-20T17:14:57Z"
created: "2011-06-20T17:14:57Z"
updated: "2026-02-27T10:43:14.879Z"
categories: ["Django"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/40ad4910499a455db9595f1cc936ee9f.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Django admin sets default form field values based on GET parameters

<div class="document">


<p>When you pass a GET query like</p>
<pre class="literal-block">?name=hoge&amp;url=fuga
</pre>
<p>to the Django admin's new record addition page, it will pre-fill the corresponding fields with these default values.</p>
<p>This works well with bookmarklets.</p>
<p>For example, you can create a bookmarklet like this:</p>
<p><a class="reference external" href="javascript:window.open('https://example.com/admin/spamapp/eggmodel/add/?title='+encodeURIComponent(document.title)+'&amp;url='+encodeURIComponent(location.href),'_blank','width=800,height=600,menubar=no,toolbar=no,resizable=yes,scrollbars=yes');void(0">javascript:window.open('https://example.com/admin/spamapp/eggmodel/add/?title='+encodeURIComponent(document.title)+'&amp;url='+encodeURIComponent(location.href),'_blank','width=800,height=600,menubar=no,toolbar=no,resizable=yes,scrollbars=yes');void(0</a>);</p>
<p>or something similar.</p>
</div>
