Re: Making basic user:adding pdf files, admin:rates them

2018-08-19 Thread Mikhailo Keda
Create a file model with FileField, ForeignKey to user and rating column. Create a view to upload files and to view files. Admin can rate them on admin page, so no view needed for this. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubsc

Re: ValueError at /news/ Value: None must be instance of Model:

2018-08-19 Thread Mikhailo Keda
Not sure what you are using but all packages for Django + MongoDB are outdated. Why do not use PostgreSQL instead of MongoDB? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send

Re: How to delete least recently used not expired django sessions?

2018-08-19 Thread Web Architect
Hi Jason, Thanks for your response. As mentioned in my earlier post...I have a long expiry date for the sessions (and hence, the cookies) as we want our users to be always logged in or in session (till they clear their cookies). And that's what is causing the issue. The goal is to keep the

Re: How to delete least recently used not expired django sessions?

2018-08-19 Thread Web Architect
Hi Hemendra, Thanks for the workaround. Would look at it's feasibility in our existing scenario. Thanks. On Saturday, August 18, 2018 at 3:58:10 PM UTC+5:30, HEMENDRA SINGH HADA wrote: > > Hi, > > I can suggest one thing it might be useful for you. For this you need to > create one more att

Re: Data Retrieval from sqlite3

2018-08-19 Thread ruban bharath
Thank you sir , i got a solution for this On Thursday, August 16, 2018 at 5:40:29 PM UTC+5:30, Vikrant Gupta wrote: > > Hello Ruban, > > Your code may be something like this > > var=‘d’ #input from HTML > Ans=models.objects.get(name=var) > Print(Ans.batch) > > By, > Vikrant > > On Aug 16, 2018,

Re: Possible bug: Querying a model with an IntegerField value of 0 using mysql-connector/python returns a queryset where the field value becomes a NoneType 2.0.3.0

2018-08-19 Thread Jason
that is indeed weird, but suggests its an issue with python-mysql-connector, not django. https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-db-api-drivers As you can see there, mysqlclient is the django project recommended way to interface with mysql. What are your reasons for going w

Making basic user:adding pdf files, admin:rates them

2018-08-19 Thread Email1212xxpl
Hi guys, im trying to make a website where users add files and 1 superuser(admin) is rating them from 0-5. User cant modify the ratings but only can see them. What FK in database should i use and what models,views or "adding files" function should i use? -- You received this message because yo

Possible bug: Querying a model with an IntegerField value of 0 using mysql-connector/python returns a queryset where the field value becomes a NoneType 2.0.3.0

2018-08-19 Thread Marcus Grass
Hi, I ran into a strange problem when i switched from using mysqlclient to mysql-connector/python. In practice: class Foo(models.Model): bar = models.IntegerField(default=0, null=False) queryset = Foo.objects.all().filter(bar=0) print(queryset[0].bar) # prints None Anyone know a fix for thi

Re: What's the Better approach to do these?

2018-08-19 Thread Julian
Hello Fellipe, sounds like you're developing a multi-tenancy webapp. Maybe https://github.com/bernardopires/django-tenant-schemas is the right tool for you. Regards, Julian Am Sonntag, 19. August 2018 17:29:16 UTC+2 schrieb Fellipe Henrique: > > Hello, > > I need to build a system.. each user

Fail to create Django registration form with email and password only

2018-08-19 Thread Yan Cheng Cheok
Creating basic registration/ authentication in Django is insanely hard. After many tries, I manage to create basic registration/ authentication in Django using username and password. [image: enter image description here] The code is shown in https://gi

SwaggerUI template override

2018-08-19 Thread Christian
Hi, I'm trying to use a customized version of index as describe here- https://django-rest-swagger.readthedocs.io/en/latest/customization/#customization I tried different places and settings in the TEMPLATE settings.py, but It won't work. Thanks in advance Christian -- You received this mess

What's the Better approach to do these?

2018-08-19 Thread Fellipe Henrique
Hello, I need to build a system.. each user will be a customer.. and each costumer will be products and sales... I do not want to build a system, and create "sub-domais" and for each sub-domains a create a "new" clone of my system... it's hard maintenance.. I think these: each model, I create a

ValueError at /news/ Value: None must be instance of Model:

2018-08-19 Thread Sagar
Hi, I'm trying to create embedded documents in mongodb using django. I'm facing this error when I tried to insert a post in database. "ValueError at /post/Value: None must be instance of Model: " Here is my code. models.py from djongo import models # Schema for comments collection which include

Re: How to filter *every* query on django?

2018-08-19 Thread Fellipe Henrique
Thanks Andreas, Using your tip, I installed django-tools app, and now I can get the current user junt using single line... :) One question... these locals variable, change for each connection? example: I have 1 site, and I want to get several models, with FK for each user.. so.. User1 can only s

Channels ERROR: Task was destroyed but it is pending!

2018-08-19 Thread Anh Tran
I'm using Channels 2.1.3 with ASGI server is `uvicorn`. ERROR: Task was destroyed but it is pending! task: wait_for=> ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/admin/webapps/yy/venv3/lib/python3.6/site-packages/uvicorn/protocols/websockets/websockets_i

doubt in annotate

2018-08-19 Thread vitanshu . sahu
input - Review.objects.values('description','user','review_type','reviewmapping__insitute').annotate(Count('description','user')).annotate(Count('review_type','reviewmapping__insitute')).count() output - 2720 this query does not give id of 2720 objects for filter objects for ids I use input -

query in annotate

2018-08-19 Thread vitanshu . sahu
In [2]: Review.objects.values('description','user','review_type','reviewmapping_ ...: _insitute').annotate(Count('description','user')).annotate(Count('review ...: _type','reviewmapping__insitute')).count() Out[2]: 2720 I want ids of these for filter reviews for this I use In [3]: Review

Re: Google Api Client

2018-08-19 Thread Jason
> > If you are getting a 200 response - then the request has succeeded without > any errors - therefore this is more about handilng the response from the > google api. Unless 200 *is* the default response from the API. I know its unlikely, being a Google API, but I have worked with several A

smart_urlquote fails with some URLs - is this unfixable?

2018-08-19 Thread Mike Dewhirst
Django 1.11.15 Python 2.7/3.6 Ubuntu 16.04 (staging and production) Windows 10 development. Postgres 9.6. Haven't tried this beyond development yet. My app relies on the Admin and uses a widget which adjusts the clicked link to open in a new tab instead of the current tab like this ... class

Re: How to filter *every* query on django?

2018-08-19 Thread Andréas Kühne
What you can do is add a middleware that sets the current user in a thread local variable. That way you can then add a custom model manager that reads that variable. Then all of your filters will be set automatically. Regards, Andréas 2018-08-18 17:46 GMT+02:00 Fellipe Henrique : > Thanks Jaso

Re: Convoluted setup information

2018-08-19 Thread Andréas Kühne
The problem is that installing virtualenv and so on is OS specific - and requires a lot of different setups. However - it IS optional. You can definately install django per default on your system - should you want that. I think the reason the setup documents for django don't include information ab

Re: Google Api Client

2018-08-19 Thread Andréas Kühne
If you are getting a 200 response - then the request has succeeded without any errors - therefore this is more about handilng the response from the google api. You will need to look at the google api docs to see what is returned by the REST endpoint. This is not a django issue, but more how to re