Re: im a newbe, i'm trying to get the username in a view

2020-11-14 Thread mike vickers
You would want to include that line in a method, not as a class attribute. For example: def get(self, request): user = request.user.username ... return render(... On Sat, Nov 14, 2020 at 9:37 AM Kasper Laudrup wrote: > Hi Barbara, > > On 13/11/2020 22.46, Barbara Leonar

Re: How to print sequence number in python

2020-11-14 Thread mike vickers
Python has the enumerate function for these situations. for i, item in enumerate(items): #your print statement here 'i' will give you the index of the list/iterable, and item will give you the item. On Sat, 14 Nov 2020 at 11:57, paidjoo indo wrote: > Hello I'm newbie in python, I'm learni

Re: Deploying in aws/Heroku

2020-11-18 Thread mike vickers
https://www.youtube.com/watch?v=kt3ZtW9MXhw&list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p&index=16 This whole django tutorial is pretty good on basics, and worth a watch. On Wed, 18 Nov 2020 at 09:45, Siddharth Nahata wrote: > Hi All, > > I have been learning for 2 months now and i have created a eco

Re: Django User authentication OR Custom Model For the Situation

2020-11-23 Thread mike vickers
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html This is a nice reference that goes over the pros/cons of the different approaches to your problem. On Mon, 23 Nov 2020 at 08:41, Neeraj Rana wrote: > I am trying to create two different types of users

Resources for writing tests

2020-12-02 Thread mike vickers
Does anyone know of any good resources walking you through writing tests for django? I've read through their documentation, and I've written a few, but I'm wondering if there's someone out there with a tutorial that really spells out a good approach. Thank you! -- You received this message becau

Re: Resources for writing tests

2020-12-02 Thread mike vickers
This is perfect, thank you. On Wed, 2 Dec 2020 at 12:15, Shishir Jha wrote: > You can look for obey the testing goat book in python. It covers tdd with > python and django > > On Wed, 2 Dec 2020, 10:12 pm mike vickers, wrote: > >> Does anyone know of any good resource

Re: CSRF issue in default login

2022-06-17 Thread mike vickers
I was having a similar issue after setting up https with certbot. After searching around, I found adding this to settings worked. CSRF_TRUSTED_ORIGINS = ["https://yourdomain.com";, "https://www.yourdomain.com";] I'd be curious to hear from others, because I'm *not *an expert in how to best set up