SHARE
TWEET

Untitled

a guest Oct 21st, 2019 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Model
  2. ========
  3. def viewtype(models.Model):
  4.     user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='worktype')
  5.     user_Type = models.CharField(default='student', max_length=30)
  6.  
  7. View
  8. ========
  9. def teacher(request):
  10.     data = studentformsave.objects.all()
  11.     return render(request, 'teacher.html', {'data': data})
  12.  
  13. আমি কিভাবে লগিন করা ইউজারের সাথে viewtype টেবিলের user_Type ডাটা পাইতে পারি
  14.  
  15. Template
  16. ==========
  17. {{ User.viewtype.user_Type}}
  18. এটা দিলে কোন ডাটা আসে না...
  19. আর আমি চাচ্ছি
  20. {% if User.viewtype.user_Type != 'Admin' %}
  21. {% include 'html' %}
  22. {%endif%}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top