Re: [PROBLEM] Creacion de primera apps de djangogirls, error en models.py

2020-04-19 Thread Gavin Wiener
¿Has instalado Django con pip? On Saturday, April 18, 2020 at 5:35:22 AM UTC+8, lucas bonet wrote: > > Hola, estoy creando la primera aplicacion de django con pyton y cuando > llega el momento de configurar en el directorio de blog--> model.py copio > las lineas de comando del tutrorial y me rep

Re: Models as choices

2020-04-16 Thread Gavin Wiener
y, April 17, 2020 at 1:51:05 PM UTC+8, shreehari Vaasistha L wrote: > > i get this error when trying in your way: > > Cannot assign "2": "User.highest_degree" must be a "Degree" instance. > > On Thursday, April 16, 2020 at 5:31:07 PM UTC+5:30, G

Re: Cannot Redirect to other page

2020-04-16 Thread Gavin Wiener
I did include example, the last sentence of the first paragraph. You need to get rid of the inner function, I don't know why that was written. I needs to look more if request.method =="GET": return the regular page elif request.method == "POST": process the answers that have been sent by t

Re: Cannot Redirect to other page

2020-04-16 Thread Gavin Wiener
I did include some examples, the last sentence of the first paragraph. You need to get rid of the inner function, I don't know why it was created. It needs to look more like this if request.method == "GET": On Wednesday, April 15, 2020 at 8:22:35 PM UTC+8, pui hei Li wrote: > > I am writing a

Re: Capture URL values in a CBV

2020-04-16 Thread Gavin Wiener
Hey Tim The bigger question is, what are you trying to achieve? With the DetailView, fetching the object with the primary key is already handled for you, as you've seen the object will already be available in the template. This website is very useful to know which functions are implemented in

Re: Models as choices

2020-04-16 Thread Gavin Wiener
Couldn't the User just have a ForeignKey on countries? On Thursday, April 16, 2020 at 12:52:07 PM UTC+8, shreehari Vaasistha L wrote: > > how can i use model x values as choices for model y ? > > for eg: > class countries(models.Model): > country = models.CharField(max_length=200) > > def __str

Re: Cannot Redirect to other page

2020-04-16 Thread Gavin Wiener
So the "return" inside the inner function won't automatically "trigger". `redirect` is a shortcut function which constructs a HttpResponseRedirect. At the moment, you're calling the function, and the HttpResponseRedirect instance is returned from the function you're not actually doing anything