Re: Write urls without regex in DRF

2019-05-22 Thread Rounak Jain
I cannot see any reply On Thursday, May 23, 2019 at 7:56:54 AM UTC+5:30, Kevin Jay wrote: > > kevin@kjay,net > > On Wed, May 22, 2019 at 10:19 AM Rounak Jain > wrote: > >> >> I am using DRF Viewsets to auto-generate URLs for different views. Is it >> possible to write the code below without

Re: Write urls without regex in DRF

2019-05-22 Thread Kevin Jay
kevin@kjay,net On Wed, May 22, 2019 at 10:19 AM Rounak Jain wrote: > > I am using DRF Viewsets to auto-generate URLs for different views. Is it > possible to write the code below without using regex? > Thanks > > from .views import TaskViewSet > from rest_framework.routers import DefaultRouter

Re: Write urls without regex in DRF

2019-05-22 Thread Rounak Jain
Thanks for the reply. I understand how to use them in urls.py when creating normal routes but here in case of drf, it would help if you could show me how to do it On Wed, May 22, 2019 at 10:11 PM Onasanya Tunde wrote: > Use Django2.X > > -- > You received this message because you are subscribed

Show different views based on user

2019-05-22 Thread Rounak Jain
I am new to Django. Below code returns objects created by the logged in user. If the user's role property has value 'super', then I want all the objects to be shown. If the user's role property is 'inter', then I want to show all objects except objects created by 'super'. Where is the right place

Write urls without regex in DRF

2019-05-22 Thread Onasanya Tunde
Use Django2.X -- 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 an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to

Re: My developers have run amok

2019-05-22 Thread Dan Davis
Sure - setting it up is easy. There are hard questions about database mutations however. If you drop column bar from table Fubar, then the old code is still querying for buth Fu and Bar: SELECT id, fu, bar FROM fubar On-premise, this is the case for maybe 10 seconds, tops. In the

Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread johnpaul mulongo
On Wednesday, May 22, 2019 at 3:48:16 PM UTC+3, omar ahmed wrote: > > hello .. > just finished my first project with django but i can not publish it > because my default python is python 2.7.12 and Heroku now does not support > it .. > now i installed python 3.6.8 how can i set it as

Question on logging best practices and ALLOWED_HOST

2019-05-22 Thread Dan Davis
*First Question - How valuable is the check on ALLOWED_HOST? * How many folks out there simply have settings: ALLOWED_HOSTS = ['*'] *Second Question - What is the best practice for enriching the log record?* On-premise, we've struggled with the interaction of the AdminEmailHandler and

Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread James Schneider
No On Wed, May 22, 2019, 10:22 AM johnpaul mulongo wrote: > > > On Wednesday, May 22, 2019 at 3:48:16 PM UTC+3, omar ahmed wrote: >> >> hello .. >> just finished my first project with django but i can not publish it >> because my default python is python 2.7.12 and Heroku now does not support >>

Write urls without regex in DRF

2019-05-22 Thread Rounak Jain
I am using DRF Viewsets to auto-generate URLs for different views. Is it possible to write the code below without using regex? Thanks from .views import TaskViewSet from rest_framework.routers import DefaultRouter router = DefaultRouter() router.register(r'', TaskViewSet, basename='task')

Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread omar ahmed
thank you nick it works -- 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 an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to

Re: data not coming into html

2019-05-22 Thread Soumen Khatua
I'm using media for development purpose and i configured that acordingly,So I don't think this could be the problem.Not new actually. please go through this link once:https://github.com/Herosoumen/clothproject On Wed, May 22, 2019 at 7:12 PM Anirudh Jain wrote: > Why is your shop templates

Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread Chetan Ganji
Hi Omar, I have added these settings to me ~/.bashrc file in Kubuntu 18.04. Same would work for rest of the linux with minor changes. First group would be your answer. Second groups of lines are used for virtualenv settings Third group of lines are to make my life easier by saving me typing the

Re: data not coming into html

2019-05-22 Thread Anirudh Jain
Why is your shop templates folder outside the shop app folder? You dont even have any static files folder, niether in shop app nor in cart app. May be you could manage it first. BTW are you new to django? (just asking) On Wed, 22 May 2019, 19:03 Soumen Khatua, wrote: > *cart.py* > > class

Re: data not coming into html

2019-05-22 Thread Soumen Khatua
*cart.py* class Cart(object): def __init__(self,request): self.session = request.session cart = self.session.get(settings.CART_SESSION_ID) if not cart: # save an empty cart in the session cart = self.session[settings.CART_SESSION_ID] = {} self.cart = cart def add(self,product,quantity =

Re: data not coming into html

2019-05-22 Thread Anirudh Jain
Can you tell which function in which app you are using to show data in which template ? On Wed, 22 May 2019, 18:56 Soumen Khatua, wrote: > Hi Folks, > Guys I'm not getting my data into html after rendered that still I'm not > getting my data,i'm sharing my github link: >

Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread Aldian Fazrihady
Omar, if you upgraded your system to Ubuntu 18.04, it will install Python 3.6 for you. Aldian Fazrihady https://www.aldianfazrihady.com/en-us/ On Wed, May 22, 2019 at 9:22 PM omar ahmed wrote: > ok .. i did it but it make my env with python3.5 > > > On Wednesday, May 22, 2019 at 3:09:37 PM

Dealing with global or session objects

2019-05-22 Thread Jean-Noël Colin
Hi, I'm coming from a java world, where there exists different scopes for objects: application-, session-, request scopes all define different lifecycle for objects. I have some difficulties in finding an equivalent approach in Django. Here's the need: my project stores its custom

data not coming into html

2019-05-22 Thread Soumen Khatua
Hi Folks, Guys I'm not getting my data into html after rendered that still I'm not getting my data,i'm sharing my github link: https://github.com/Herosoumen/clothproject.Please go through this link.Please guys help me it's urgent. Thank You -- You received this message because you are

Re: Data Level Access Control

2019-05-22 Thread Yang Luo
Hi datta, You can try PyCasbin: https://github.com/pycasbin/django-casbin On Wednesday, January 6, 2010 at 4:55:12 AM UTC+8, datta wrote: > > Hi, > > Is there a setting/module that helps me to achieve data level access > control in a web application. > > For example, if I have a sales app, the

Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread omar ahmed
ok .. i did it but it make my env with python3.5 On Wednesday, May 22, 2019 at 3:09:37 PM UTC+2, Nick Sarbicki wrote: > > Hi Omar, > > It is generally recommended to _not_ set python3 as your system default. > This is stated in PEP 394 >

Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread Nick Sarbicki
Hi Omar, It is generally recommended to _not_ set python3 as your system default. This is stated in PEP 394 . The reasoning being there may be internal and third party processes which still expect the default python

set python 3.6.8 default in my ubuntu

2019-05-22 Thread omar ahmed
hello .. just finished my first project with django but i can not publish it because my default python is python 2.7.12 and Heroku now does not support it .. now i installed python 3.6.8 how can i set it as default python version to make my projects with virtualenv ? thanks in advance --

Re: Customising django user model

2019-05-22 Thread אורי
Hi Sipum, We did it on Speedy Net and you can see our models and settings there: https://github.com/speedy-net/speedy-net https://github.com/speedy-net/speedy-net/blob/master/speedy/core/accounts/models.py#L160

Re: Occasional CSRF cookie not set django 1.11 -> 2.1

2019-05-22 Thread Yusuf Musleh
Hi Aldian, thanks for the insight. We don't set "CSRF_COOKIE_SECURE = True", django defaults it to False, allowing cookies to be sent to non https connections, however that being said we know that the error occurs even on https. We redirect all our traffic to https as well. On Wednesday,

Re: Occasional CSRF cookie not set django 1.11 -> 2.1

2019-05-22 Thread Aldian Fazrihady
Yusuf, did you use CSRF_COOKIE_SECURE = True and access the website using http instead of https? https://stackoverflow.com/questions/17716624/django-csrf-cookie-not-set On Wed, May 22, 2019 at 6:18 PM Yusuf Musleh wrote: > Hello Aldian, > > Thank you for your reply. > > That was one of the

some random problem

2019-05-22 Thread Soumen Khatua
Hi Folks, I'm getting len(cart) is 0 and after iterate *item is not coming from cart* in this project,plese tell me where is my problem. I'm sharing my git repo please go through it and please tell me the what i missed.It's urgent. Here is the link: https://github.com/Herosoumen/clothproject

Re: TypeError

2019-05-22 Thread Bob Gailer
On May 22, 2019 6:09 AM, "Soumen Khatua" wrote: > > Hi Folks, > > I'm getting this error "TypeError:" everytime, Can You guys tell me where is the problem in this code. it would help us a lot if you would copy the entire traceback and paste it into an email reply. > Cart > > views.py >

PostGIS : already installed, but with scripts, not extension

2019-05-22 Thread Not Sqrt
Hi, I originally installed PostGiS with : psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql and similar commands ( http://postgis.net/docs/manual-2.5/postgis_installation.html#create_new_db). So not the new method

Re: Occasional CSRF cookie not set django 1.11 -> 2.1

2019-05-22 Thread Yusuf Musleh
Hello Aldian, Thank you for your reply. That was one of the very first things we investigated, but it does not seem to be the case, as the error happens sometimes when the page/form is still fresh, in addition to that, the error message would have been different if the token in the form

TypeError

2019-05-22 Thread Soumen Khatua
Hi Folks, I'm getting this error "TypeError:" everytime, Can You guys tell me where is the problem in this code. *Cart* views.py @require_POST def cart_add(request,product_id): cart = Cart(request) product = get_object_or_404(Product,id = product_id) form =

Re: Need help for Cascading Drop Down for Continent, Country in Admin GUI - Not Getting correct Answer from Many Days

2019-05-22 Thread Chetan Ganji
Hello Balaji Sir, AFAIK, Django does not filter the foreign key fields by default, Cascading Drop Down is not available by default in django. If the filtering was to be done on the initial value only, you could have overwritten the __init__() in the form to filter the fk values. But that does not

Re: Need help for Cascading Drop Down for Continent, Country in Admin GUI - Not Getting correct Answer from Many Days

2019-05-22 Thread Nitin Kumar
Hi, The field 'continent' in Location model is redundant, should not be there. class Location(models.Model): continent = models.ForeignKey(Continent,on_delete=models.CASCADE) country = models.ForeignKey(Country,on_delete=models.CASCADE) city = models.CharField(max_length=50)

Re: 'WSGIRequest' object has no attribute '

2019-05-22 Thread Abu Yusuf
Which error? On Wed, May 22, 2019 at 12:15 PM sagar ninave wrote: > after doing this i am getting another error > > On Wed, May 22, 2019 at 11:44 AM Abu Yusuf > wrote: > >> It's middleware. Not middleware_classes: >> >> MIDDLEWARE = [ >> 'django.middleware.security.SecurityMiddleware', >>

Re: 'WSGIRequest' object has no attribute '

2019-05-22 Thread sagar ninave
after doing this i am getting another error On Wed, May 22, 2019 at 11:44 AM Abu Yusuf wrote: > It's middleware. Not middleware_classes: > > MIDDLEWARE = [ > 'django.middleware.security.SecurityMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', >

Re: 'WSGIRequest' object has no attribute '

2019-05-22 Thread sagar ninave
i have tried already On Wed, May 22, 2019 at 11:45 AM sagar ninave wrote: > after doing this i am getting another error > > On Wed, May 22, 2019 at 11:44 AM Abu Yusuf > wrote: > >> It's middleware. Not middleware_classes: >> >> MIDDLEWARE = [ >> 'django.middleware.security.SecurityMiddleware',

Re: 'WSGIRequest' object has no attribute '

2019-05-22 Thread Abu Yusuf
It's middleware. Not middleware_classes: MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',

Re: 'WSGIRequest' object has no attribute '

2019-05-22 Thread sagar ninave
i am also using same url.py On Wed, May 22, 2019 at 11:33 AM Abu Yusuf wrote: > I did use this urls.py: > > from django.conf.urls import url > from django.contrib import admin > from django.urls import path > # from microblog.admin import microblogs_admin_site > > urlpatterns = [ >

Re: 'WSGIRequest' object has no attribute '

2019-05-22 Thread Abu Yusuf
I did use this urls.py: from django.conf.urls import url from django.contrib import admin from django.urls import path # from microblog.admin import microblogs_admin_site urlpatterns = [ path('admin/', admin.site.urls), # url(r'^microblogs-admin/', microblogs_admin_site.urls), ] On Wed, May

Re: 'WSGIRequest' object has no attribute '

2019-05-22 Thread Abu Yusuf
It's working fine. [image: wsgi.png] On Wed, May 22, 2019 at 11:57 AM sagar ninave wrote: > when i am opening admin panel then it is getting error > > On Wed, May 22, 2019 at 11:19 AM Abu Yusuf > wrote: > >> I did run your project and it's working fine. >> >> On Wed, May 22, 2019 at 11:43 AM