title: Profile's href attribute shows empty string on creation Django
body: <p>After creating a new user, profile of user is created but it doesn't show default image. When I check view page source, src attribute show empty string like <code>src=''</code>. But when I go to profile link where I can update my profile then at that time it automatically load default image and and all the posts created by that user will get that default image.</p>
  
  <p>New user created and new post added by user</p>
  
  <p><a href="https://i.stack.imgur.com/BDIJK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BDIJK.png" alt="New user created and new post added by user"></a></p>
  
  <p>when I click user profile, it automatically load default image</p>
  
  <p><a href="https://i.stack.imgur.com/Y6Q79.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y6Q79.png" alt="when I click user profile"></a></p>
  
  <p>and all posts created by that user get the default image.
  <a href="https://i.stack.imgur.com/BXcsH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BXcsH.png" alt="enter image description here"></a></p>
  
  <p>View page source
  <a href="https://i.stack.imgur.com/27vCv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/27vCv.png" alt="enter image description here"></a></p>
  
  <p><code>mdoels.py</code></p>
  
  <pre><code>class Profile(models.Model):
      user = models.OneToOneField(User, on_delete=models.CASCADE)
      image = models.ImageField(default='default.jpg', upload_to='profile_pics')
  
      def __str__(self):
          return f'{self.user.username} Profile'
  
      def save(self, *args, **kwargs):
          super().save(*args, **kwargs)
          img = Image.open(self.image.path)
          if img.height &gt; 300 or img.width &gt; 300:
              output_size = (300, 300)
              img.thumbnail(output_size)
              img.save(self.image.path)
  </code></pre>
  
  <p><code>forms.py</code></p>
  
  <pre><code>class UserRegistrationForm(UserCreationForm):
      email = forms.EmailField()
  
      class Meta:
          model = User
          fields = ['username', 'email', 'password1', 'password2']
  
  class UserUpdateForm(forms.ModelForm):
      email = forms.EmailField()
  
      class Meta:
          model = User
          fields = ['username', 'email']
  
  class ProfileUpdateForm(forms.ModelForm):
      class Meta:
          model = Profile
          fields = ['image']
  </code></pre>
  
  <p><code>view.py</code></p>
  
  <pre><code>@login_required
  def profile(request):
      Profile.objects.get_or_create(user=request.user)
      if request.method == 'POST':
          u_form = UserUpdateForm(data=request.POST, instance=request.user)
          p_form = ProfileUpdateForm(data=request.POST, instance=request.user.profile, files=request.FILES)
          if u_form.is_valid() and p_form.is_valid():
              u_form.save()
              p_form.save()
              messages.success(request, f'Your account has been updated!')
              return redirect('profile')
      else:
          u_form = UserUpdateForm(instance=request.user)
          p_form = ProfileUpdateForm(instance=request.user.profile)
  
      context = {
          'u_form':u_form,
          'p_form':p_form
      }
      return render(request, 'users/profile.html', context)
  </code></pre>
  
  <p><code>signals.py</code></p>
  
  <pre><code>from django.db.models.signals import post_save
  from django.contrib.auth.models import User
  from django.dispatch import receiver
  
  from .models import Profile
  
  @receiver(post_save, sender=User)
  def create_profile(sender, instance, created, **kwargs):
      if created:
          Profile.objects.create(user=instance)
  
  
  @receiver(post_save, sender=User)
  def save_profile(sender, instance, **kwargs):
      instance.profile.save()
  </code></pre>
  
  <p>Is it because of signals or line Profile.objects.get_or_create(user=request.user) in profile view ?
  before that I had an error: <code>RelatedObjectDoesNotExist. User has no profile</code>. I solved using Profile.objects.get_or_create(user=request.user).</p>
  
  <p><strong>Edit: profile template added</strong>
  <code>profile.html</code></p>
  
  <pre><code>{% extends "blog/base.html" %}
  {% load crispy_forms_tags %}
  
  {% block title %}
    {{ user }}'s' Profile
  {% endblock title %}
  
  {% block content %}
    &lt;div class="content-section"&gt;
      &lt;div class="media"&gt;
        &lt;img src="{{ user.profile.image.url }}" alt="" class="rounded-circle account-img"&gt;
        &lt;div class="media-body"&gt;
          &lt;h2 class="account-heading"&gt; {{ user.username }} &lt;/h2&gt;
          &lt;p class="text-secondary"&gt;{{ user.email }}&lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;form action="" method="post" enctype="multipart/form-data"&gt;
        {% csrf_token %}
        &lt;fieldset class="form-group"&gt;
          &lt;legend class="border-bottom mb-4"&gt;Profile Info&lt;/legend&gt;
          {{ u_form|crispy }}
          {{ p_form|crispy }}
        &lt;/fieldset&gt;
        &lt;div class="form-group"&gt;
          &lt;button class="btn btn-outline-info" type="submit"&gt;Update&lt;/button&gt;
        &lt;/div&gt;
      &lt;/form&gt;
    &lt;/div&gt;
  {% endblock content %}
  </code></pre>