Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Dhwanil Shah
Can you post your views.py code On Fri, 16 Oct 2020 at 12:26, Salima Begum wrote: > Hi all, > vikreya > mysite > .cache > .idea >.pytest_cache > logs > media > mysite > __init__.py >manage.py >settings.py >ur

Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Shahprogrammer
Can you post your code of views.py On Friday, 16 October, 2020 at 12:27:19 pm UTC+5:30 sali...@rohteksolutions.com wrote: > Hi all, > vikreya > mysite > .cache > .idea >.pytest_cache > logs > media > mysite > > __init__.py >manage.p

Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Salima Begum
urls.py path('ProductDetails/', views.onClickSearch.ProductDetails, name='ProductDetails'), views.py class onClickSearch(): def ProductDetails(request, id): try: email = request.session.get('email') proddtls = vk_master_table.objects.filter(id=id).first()

Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Akinfolarin Stephen
The problem is you are trying to import views from where you have not created it I guess the page is a folder then create the views.py inside of it On Fri, Oct 16, 2020, 08:10 Salima Begum wrote: > urls.py > > path('ProductDetails/', views.onClickSearch.ProductDetails, > name='ProductDetails')

Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Salima Begum
Inside pages folder I already have views.py Thanks ~salima On Fri, Oct 16, 2020 at 1:28 PM Akinfolarin Stephen < akinfolarinsteph...@gmail.com> wrote: > The problem is you are trying to import views from where you have not > created it I guess the page is a folder then create the views.py insid

Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Shahprogrammer
You have created a class named onClickSearch with method ProductDetails . So you can't import a method of a class. To use the method you need to import class. So in place of importing from pages.views import ProductDetails in test_views.py do from pages.views import onClickSearch & then us

Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Salima Begum
Thank you for your reply I did that again I am getting this error ___ TestViews.test_product_detail_authenticated klass = , args = (), kwargs = {'pk': 22}, queryset = ]> def g

pages.models.vk_ls_product_search.DoesNotExist: vk_ls_product_search matching query does not exist.

2020-10-16 Thread Salima Begum
Hi all, I have written test case for ProductDetails_ls for views *views.py* ``` class onClickSearch(): def ProductDetails_ls(request, id): # product_ls = vk_ls_product_search.objects.get(id=id) product_ls = get_object_or_404(vk_ls_product_search, id=id) email = requ

How to make recursive ManyToMany relationships through an intermediate model symmetrical

2020-10-16 Thread gjgilles via Django users
There are no responses to the same question on stackoverflow, so hopefully someone here can provide a solution.   I've read the docs.

How to allow App1 users to use App2

2020-10-16 Thread r.raj...@gmail.com
Django Rest Framework: Django RestApp1 and DB-1 - All the users exist in DB-1, django oauth2 token based authentication (Bearer token) is used by the users. Now i got a new app: Django RestApp2 and DB-2 Requirement: I would consider doing the new user creation and get token calls ..etc in

Re: How to make recursive ManyToMany relationships through an intermediate model symmetrical

2020-10-16 Thread David Nugent
This is expected with your code. You've created an asymmetric relationship from bill to ted, but not the reverse. This would be appropriate in a "follow" relationship. For symmetric relationships you need to create records in both directions. There are a few ways to do this but a helper functio

Re: Pasting images versus uploading

2020-10-16 Thread Mike Dewhirst
RyanThank you for that research and advice. I need to follow through and absorb the implications. That means trying both and then deciding. I'll report in due course.Thanks to allMike--(Unsigned mail from my phone) Original message From: Ryan Nowakowski Date: 15/10/20 09:28

Re: How to make recursive ManyToMany relationships through an intermediate model symmetrical

2020-10-16 Thread coolguy
With your example, you can also find the records through>>> ted.person_set.all(). On Friday, October 16, 2020 at 7:05:51 PM UTC-4 David Nugent wrote: > This is expected with your code. You've created an asymmetric > relationship from bill to ted, but not the reverse. This would be > appropri

Re: How to make recursive ManyToMany relationships through an intermediate model symmetrical

2020-10-16 Thread David Nugent
Just to add, I don't think django supports symmetrical M2M relations with additional data / explicit through model without the shim I suggested. For example, this works: from django.db import models class Person(models.Model): name = models.CharField(max_length=255) friends = models.M

Re: How to make recursive ManyToMany relationships through an intermediate model symmetrical

2020-10-16 Thread gjgilles via Django users
Thanks for all for the replies! @David, the helper function works as expected. >>> from people.models import Person, Friendship >>> bill = Person(name='bill') >>> bill.save() >>> ted = Person(name='ted') >>> ted.save() >>> bill.add_friendship(ted, True) (, True) >>> bill.friends.all() ] ted.f

Re: How to make recursive ManyToMany relationships through an intermediate model symmetrical

2020-10-16 Thread David Nugent
After playing with this to answer your question and to correct my previous response, I found that it does work as documented when using a "through" model without using "through_fields". from django.db import models class Person(models.Model): name = models.CharField(max_length=255) fr

Re: Problem with Postgresql-11.9 ??

2020-10-16 Thread David Nugent
In __your__ code, most certainly. :-) You didn't say what 'training', 'input_type' and 'gender' are. It is in one or more of those where the problem exists. Do these referenced save module instances? If they are not yet saved then it will trigger this error for fields where On 13 Oct 2020,

Re: Problem with Postgresql-11.9 ??

2020-10-16 Thread David Nugent
Apologies, I must have bumped send accidentally. To complete the sentence, unless fields have null=True then referencing unsaved records here will fail because there is no id in the dependent records to provide a reference. By default there is a constraint that the reference is not null. But r