<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by 홍한석 on Medium]]></title>
        <description><![CDATA[Stories by 홍한석 on Medium]]></description>
        <link>https://medium.com/@flavono123?source=rss-3872d07c8221------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KltXhQtTSGBN-q5IuvSX8Q.jpeg</url>
            <title>Stories by 홍한석 on Medium</title>
            <link>https://medium.com/@flavono123?source=rss-3872d07c8221------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 04:47:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@flavono123/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A tricky way of using an email as a username for Django sing up form with default user model(django.]]></title>
            <link>https://medium.com/@flavono123/a-tricky-way-of-using-an-email-as-a-username-for-django-sing-up-form-with-default-user-a4b62645fc10?source=rss-3872d07c8221------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4b62645fc10</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[snippet]]></category>
            <category><![CDATA[django-auth]]></category>
            <dc:creator><![CDATA[홍한석]]></dc:creator>
            <pubDate>Fri, 02 Feb 2018 08:14:14 GMT</pubDate>
            <atom:updated>2018-02-19T07:25:14.958Z</atom:updated>
            <content:encoded><![CDATA[<h3>A tricky way of using an email as a username for Django sing up form with default user model(django.contrib.auth.User)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Or9oinEc4QwZRI67fla2Cg.png" /><figcaption>A example sign up form in my own toy project</figcaption></figure><p>There are some Django snippets for using an email as a username in sign up or login feature. Some customize the <a href="https://docs.djangoproject.com/en/2.0/ref/contrib/auth/#user-model">django.contrib.auth.models.User</a>, the default Django user model, and the others remake the Backend model for email.</p><p>But I’ve made a snippet with <strong>less codes</strong> than above. Here is an example for singup:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/68d0d8c7d1b67f77a051d1497d70f63e/href">https://medium.com/media/68d0d8c7d1b67f77a051d1497d70f63e/href</a></iframe><p>The accounts/views.py codes are very simple, just like other POST view codes handling a form. <em>The points in the </em><em>accounts/forms.py:</em></p><ol><li>Add the email filed (but would not rendered, set in saving time). <br>fields = UserCreationForm.Meta.fields + (&#39;email&#39;,)</li><li>Change the widget of username to email input.&#39;username&#39;: forms.EmailInput,</li><li>Hide the email field.<br>&#39;email&#39;: forms.HiddenInput,</li><li>In saving, set user’s email to username.<br>user.email = user.username</li></ol><p>In this way, there is a<em> database issue, duplicated columns in table of user model</em>, user_email and user_username. But in a toy project, it will reduce the codes amount. Hope you enjoy <strong>fast</strong> Django app building!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4b62645fc10" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>