Re: Prepopulate blog in b.entry_set.all()[i].blog ?

2018-10-31 Thread Tim Graham
It seems to be a bug as reported in https://code.djangoproject.com/ticket/29908. The ForeignKey must use to_field to reproduce the problem. On Saturday, October 20, 2018 at 4:38:51 AM UTC-4, Carsten Fuchs wrote: > > Can anyone help please? > > Am 2018-10-11 um 16:58 schrieb Carsten Fuchs: > >

Re: Error in function to return permissions

2018-10-31 Thread Stephen J. Butler
@login_required needs "request" as the first parameter. On Wed, Oct 31, 2018 at 11:58 AM Joel Mathew wrote: > I have a custom function to check if a user is authorized to do > certain functions: > > @login_required > def checkpermission(request, permiss): > username = request.user.username >

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Pacôme Avahouin
Yes you right Tim, i have misunderstood the purpose of height_field and width_field, i'm new in Django :) Gonna check more in the documentation and try a third-party app to resize images. Thanks a lot for the help. I appreciate. -- You received this message because you are subscribed to the Goo

Error in function to return permissions

2018-10-31 Thread Joel Mathew
I have a custom function to check if a user is authorized to do certain functions: @login_required def checkpermission(request, permiss): username = request.user.username print(f"username is {username}") print(f"User.objects.filter() is {User.objects.filter()}") userobj = User.obje

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Tim Graham
You've misunderstood the purpose of height_field and width_field. Please read the documentation: https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ImageField.height_field You need to use a third-party app to do image resizing. Check out https://djangopackages.org/grids/g

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Pacôme Avahouin
> > My model fields look like this: > > class CustomAbstractUser(AbstractBaseUser, PermissionsMixin): > """ > An abstract base class implementing a fully featured User model with > admin-compliant permissions. > > Email and password are required. Other fields are optional. > ""

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Tim Graham
height_field and width_field should be strings. What's the error and what does your model fields look like? On Wednesday, October 31, 2018 at 10:53:53 AM UTC-4, Pacôme Avahouin wrote: > > Tim you just saved me right now:) I have spent the all night trying to > figure it out. > Thanks a lot. > No

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Pacôme Avahouin
Tim you just saved me right now:) I have spent the all night trying to figure it out. Thanks a lot. Now when i removed the width_field it works fine. But how to define height_field and width_field directly from the model? Cause when i put their values in quotes i got another error. -- You recei

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Tim Graham
It looks like the width_field option on the model field isn't a string. On Wednesday, October 31, 2018 at 10:28:42 AM UTC-4, Pacôme Avahouin wrote: > > Hello Tim, > > Thanks for answering. > > Here is the complete traceback. > By the way when i commented out the 'upload_file' function still i'm >

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Pacôme Avahouin
Hello Tim, Thanks for answering. Here is the complete traceback. By the way when i commented out the 'upload_file' function still i'm getting the same error. I believe the origin might be somewhere else. Environment: Request Method: POST Request URL: http://127.0.0.1:8000/user/edit-profile

Re: How to edit model.py and serializer so I can recieve contact":{"name":"asdf","email":"ma...@email.com","phone":"1111111111"}}

2018-10-31 Thread Tim Vogt
So Do you mean i change the angular? Of my models file? If the last apply how? Sincere, Tim On Wednesday, October 31, 2018 at 12:10:51 PM UTC+1, Krishnasagar Subhedarpage wrote: > > Hi Tim, > > IMHO, you can change angular's request body as per model defined in app so > that, serializer can vali

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Tim Graham
It would be helpful to see the complete traceback. What you provided doesn't show where the exception originates. On Tuesday, October 30, 2018 at 10:38:38 PM UTC-4, Pacôme Avahouin wrote: > > Hello guys, > > I'm trying to upload user avatar (ImageField type) with my own custom user > model foll

Re: Django unit test - response context is None

2018-10-31 Thread Web Architect
Hi Jason, Thanks for your prompt response. I was using Django TestCase but it wasn't working then. Hence, I resorted to unittest as shown in Django 1.11 documentation. Also, the attribute was working fine in django shell. Please refer to the documentation here: https://docs.djangoproject.com

There's way to change "model_list" result variable name from ListView?

2018-10-31 Thread Fellipe Henrique
Hi, Normal ListView result a list with "model"_list as name... there's any way to change these name? T.·.F.·.A.·. S+F *Fellipe Henrique P. Soares* e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge' *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh <

Re: Django unit test - response context is None

2018-10-31 Thread Jason
Two things I can see: you should be inheriting from TestCase in django.test, not unittest. Second, you should find your answer at https://stackoverflow.com/questions/27136048/django-unit-test-response-context-is-none . I believe the attribute you're trying to access was deprecated in django

Django unit test - response context is None

2018-10-31 Thread Web Architect
Hi, We are using django 1.11 for our ecommerce site. We are developing unit tests for our views using django testing framework. We are facing issue with a simple implementation: import unittest from django.urls import reverse from django.test import Client class ViewTests(unittest.TestCase

Re: foreign key is not working

2018-10-31 Thread Paras Patidar
Use: on_delete = models.CASCADE In Foreign Key On Wed 31 Oct, 2018, 5:15 PM amit pant, wrote: > i used foreign key for make relationship between two model class but it > does not work properly, i used this for make subscription and on first > model their is choices for subscription. > help me wh

Re: foreign key is not working

2018-10-31 Thread Mahendra Rana
Where is model codes? On Wednesday, 31 October 2018 17:15:53 UTC+5:30, amit pant wrote: > > i used foreign key for make relationship between two model class but it > does not work properly, i used this for make subscription and on first > model their is choices for subscription. > help me why it

foreign key is not working

2018-10-31 Thread amit pant
i used foreign key for make relationship between two model class but it does not work properly, i used this for make subscription and on first model their is choices for subscription. help me why it is not working -- You received this message because you are subscribed to the Google Groups "Dj

Re: How to edit model.py and serializer so I can recieve contact":{"name":"asdf","email":"m...@email.com","phone":"1111111111"}}

2018-10-31 Thread Krishnasagar Subhedarpage
Hi Tim, IMHO, you can change angular's request body as per model defined in app so that, serializer can validate and save into table. Regards, Krishna On Wed, 31 Oct 2018 at 15:11, Tim Vogt wrote: > Hi group ;-) > > I have a little challenge. > > We have a frontend angular api. Wich sinds da

How to edit model.py and serializer so I can recieve contact":{"name":"asdf","email":"m...@email.com","phone":"1111111111"}}

2018-10-31 Thread Tim Vogt
Hi group ;-) I have a little challenge. We have a frontend angular api. Wich sinds data to my django backend from an input form. And Contact in the frontend How to just my serializer / models file right so the contact data is in my database? contact?: { name: string; email: string; phone: st