Re: Models as choices

2020-04-17 Thread Esther Camilo
This guy has plenty of tutorials building complete applications. As front-end you can use Bootstrap in your templates https://simpleisbetterthancomplex.com/ On Fri, Apr 17, 2020 at 9:57 AM Denilson Antonio Avellan < denilson.d...@gmail.com> wrote: > me pueden enviar el codigo completo ? para

Re: Models as choices

2020-04-17 Thread Denilson Antonio Avellan
me pueden enviar el codigo completo ? para hacer un login solo la interfqaz grafica sin nada de conexion a base de datos porfavor! El vie., 17 de abr. de 2020 a la(s) 00:00, Gavin Wiener ( gavinwie...@gmail.com) escribió: > If you're serializing as JSON, that primary key is literally just

Re: Models as choices

2020-04-17 Thread Gavin Wiener
If you're serializing as JSON, that primary key is literally just integer then, and the foreign key relationship requires an instance of that foreign key. So you'll need to fetch an instance of the object first. I've had this issue before, that's how I resolved it. On Friday, April 17, 2020 at

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
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, Gavin Wiener wrote: > > Couldn't the User just have a ForeignKey on countries? > > On Thursday, April 16, 2020 at 12:52:07 PM UTC+8,

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

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
Thanks for helping me out . On Thursday, April 16, 2020 at 2:34:13 PM UTC+5:30, Kasper Laudrup wrote: > > Hi Shreehari > > On 16/04/2020 10.17, shreehari Vaasistha L wrote: > > Object of type ValueError is not JSON serializable > > > > > > getting this above error > > > > First of all,

Re: Models as choices

2020-04-16 Thread Kasper Laudrup
Hi Shreehari On 16/04/2020 10.17, shreehari Vaasistha L wrote: Object of type ValueError is not JSON serializable getting this above error First of all, don't highjack other unrelated threads. Create your own with a descriptive subject. You get the error because of the lines: except

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
Object of type ValueError is not JSON serializable getting this above error. here's my views.py class UserCreateApiView(CreateAPIView): serializer_class = UserCreateSerializer def post(self,request): try: serializer=UserCreateSerializer(data=request.data) if

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
Object of type ValueError is not JSON serializable getting this above error On Thursday, April 16, 2020 at 12:57:16 PM UTC+5:30, Antje Kazimiers wrote: > > with a Foreign Key field, one-to-many relationship: > > https://docs.djangoproject.com/en/3.0/topics/db/examples/many_to_one/ > > Antje >

Re: Models as choices

2020-04-16 Thread Antje Kazimiers
with a Foreign Key field, one-to-many relationship: https://docs.djangoproject.com/en/3.0/topics/db/examples/many_to_one/ Antje On 4/16/20 6:52 AM, shreehari Vaasistha L wrote: > how can i use model x values as choices for model y ? > > for eg: > | > classcountries(models.Model): >  country

Models as choices

2020-04-15 Thread shreehari Vaasistha L
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__(self): return self.country class User(AbstractUser): """User model.""" username = None full_name = models.CharField(_("Full Name"),