title: How to display user computer display name in #Djangos, #python
body: <p>Apologies if its duplicate query, I am not able to find the answer for my question posting here.</p>
  
  <p>I have developed a webpage in Djangos hosted in development server. Webpage is accessible for anyone outside the development box. 
  requiremnet: when User access website, top right corener I want to display user computer name.(note: I am not asking users to register).</p>
  
  <p>I wrote below code which is fetching user Name, but it alwyas shows admin display name from develoment box. </p>
  
  <p>how to get user computer name where ever the webpage is opened in my LAN.</p>
  
  <pre><code>///view.py
  import ctypes
  def get_display_name():
      GetUserNameEx = ctypes.windll.secur32.GetUserNameExW
      NameDisplay = 3
      size = ctypes.pointer(ctypes.c_ulong(0))
      GetUserNameEx(NameDisplay, None, size)
      nameBuffer = ctypes.create_unicode_buffer(size.contents.value)
      GetUserNameEx(NameDisplay, nameBuffer, size)
      return(nameBuffer.value)
  
  def home_page(request):
      context = {
          "username":request.user.username,
      }
      return render(request,"default.html", context)
  
  //default.html
  &lt;div&gt;{{username}}&lt;/div&gt;
  </code></pre>