Re: problems with url and views - new to django

2019-04-21 Thread Victor H. Velasquez Rizo
*Hello Rob.*
With the url "hello/", your trying to call the "hello" function on your
view.py.
*First*, you need to import "hello" to be able to use it. from  *from
lct_app.views import hello*
*Second,* call the function. path('hello/', hello),

*urls.py*
from django.contrib import admin
from django.urls import path
from  lct_app.views import hello

urlpatterns = [
path('admin/', admin.site.urls),
path('hello/', hello),
]

*views.py*

from django.shortcuts import render

def hello(request):
   return render(request, "lct_app/templates/hello.html", {})

On Sun, Apr 21, 2019 at 5:07 PM Rob W  wrote:

> setting up a new project.
> all good, loaded up the project on localhost.
>
> however, when creating a view then setting the url, it doesn't work.
>
>
> *urls.py*
>
> from django.contrib import admin
> from django.urls import path
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('hello/', lct_app.site.urls),
>
>
> *views.py*
>
> from django.shortcuts import render
>
> def hello(request):
>return render(request, "lct_app/templates/hello.html", {})
>
> i comment out the path in urls.py, django comes back. what am i missing?
>
>
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4872beca-597c-4689-a12e-9e888c5266ca%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 



Atte...,.
Vìctor Hugo Velàsquez Rizo
Cali - Colombia

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFCXTzga%3DFAMdPFwhfp3yMEtyZkA7rzmjhB29rAG160ALuP3Og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Chat Help

2019-04-21 Thread Ahmed Ishtiaque
Hello!

Shameless plug: I've been working towards making a chat app for Django
developers to be able to use. You could check it out here
 if you want!

Best,
Ahmed

On Sun, Apr 21, 2019 at 10:50 AM Fahad Bin Munir 
wrote:

> how to create chatting system using api in djano?
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/398fbc6b-aaf7-4d2f-8107-6ea7ec1c2b81%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKizqR7Hy_iaHf1aY5EsmAH%2BVbrp0VCWsLBtM_r27BL23CqxDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 2.2.0 StatReloader not responding to filechanges

2019-04-21 Thread jacob
I submitted a bug report and am working on a patch:

https://code.djangoproject.com/ticket/30361

Also, it appears that some fixes to the StatReloader may be coming in 2.2.1 
(or 2.3?) which could also help

On Thursday, April 11, 2019 at 3:34:27 PM UTC-7, ja...@workflowy.com wrote:
>
> After more research, I noticed that Django is using the default timeout of 
> 1sec for the pywatchman client. When I try running the watch with a higher 
> timeout, I am able to start it successfully.
>
> I would suggest that Django makes the timeout configurable, or chooses a 
> higher default value.
>
> On Wednesday, April 10, 2019 at 5:05:31 AM UTC-7, in...@bobvoorneveld.nl 
> wrote:
>>
>> Since the introduction to Watchman, with the failover to StatReloader, 
>> the file changes aren't picked up.
>>
>> We're running our Django development environment in 
>> Docker/Docker-compose, and 2.1.7 everything is still fine. But updating to 
>> 2.2.0, the file changes aren't picked up (or rarely).
>>
>> We have installed Watchman in our docker, but then there was a timeout.
>>
>> Any suggestions on how to fix watchman or make StatReloader work as it 
>> was in Django 2.1.7?
>>
>> Logs:
>>
>> [10/Apr/2019 12:39:13] INFO [django.utils.autoreload:578] Watching for 
>> file changes with WatchmanReloader
>> Performing system checks...
>>
>> System check identified no issues (0 silenced).
>> April 10, 2019 - 12:39:16
>> Django version 2.2, using settings 'project.settings'
>> Starting ASGI/Channels version 2.1.7 development server at http://0:8000/
>> Quit the server with CONTROL-C.
>> [10/Apr/2019 12:39:16] INFO [daphne.server:111] HTTP/2 support not 
>> enabled (install the http2 and tls Twisted extras)
>> [10/Apr/2019 12:39:16] INFO [daphne.server:119] Configuring endpoint 
>> tcp:port=8000:interface=0
>> [10/Apr/2019 12:39:16] INFO [daphne.server:153] Listening on TCP address 
>> 0.0.0.0:8000
>> [10/Apr/2019 12:39:18] ERROR [django.utils.autoreload:569] Error 
>> connecting to Watchman: timed out waiting for response, while executing 
>> ('watch-project', '/home/docker/project')
>> [10/Apr/2019 12:39:18] INFO [django.utils.autoreload:570] Watching for 
>> file changes with StatReloader
>>
>>
>> This is our docker file for our web docker:
>>
>> FROM python:3.7
>> ENV PYTHONUNBUFFERED 1
>>
>> RUN apt-get update -y
>> RUN apt-get install -y \
>> binutils \
>> libproj-dev \
>> gdal-bin \
>> apt-utils \
>>   gcc \
>>   gettext \
>>   sqlite3 \
>>   python3-dev \
>>   software-properties-common \
>>   sudo \
>>--no-install-recommends && rm -rf /var/lib/apt/lists/*
>>
>> ENV HOME /home/docker
>> RUN mkdir -p /home/docker/
>>
>> WORKDIR $HOME
>> RUN git clone https://github.com/facebook/watchman.git
>> WORKDIR $HOME/watchman/
>> RUN git checkout v4.9.0
>> RUN ./autogen.sh
>> RUN ./configure
>> RUN make
>> RUN sudo make install
>>
>> # USER docker
>> WORKDIR $HOME/project
>>
>> RUN cd $HOME/project/
>>
>> RUN sudo -H pip install -U pipenv==2018.10.9
>>
>> COPY Pipfile $HOME/project/Pipfile
>> COPY Pipfile.lock $HOME/project/Pipfile.lock
>>
>> RUN pipenv sync --dev
>>
>>
>>
>> docker-compose.yml
>>
>> version: '3.3'
>>
>> services:
>>   web:
>> build: .
>> command: pipenv run python manage.py runserver 0:8000
>> volumes:
>>   - .:/home/docker/project
>> env_file:
>>   - ".env"
>> ports:
>>   - "8002:8000"
>> depends_on:
>>   - postgres-db
>> networks:
>>   - app-network
>>
>>   postgres-db:
>> image: kartoza/postgis
>> ports:
>>   - "5433:5432"
>> env_file:
>>   - ".env"
>> healthcheck:
>>   test: ["CMD-SHELL", "pg_isready -U postgres"]
>>   interval: 10s
>>   timeout: 5s
>>   retries: 5
>> networks:
>>   - app-network
>>
>> networks:
>>   app-network:
>> driver: bridge
>>
>>
>>
>> Pipfile
>>
>> [[source]]
>> url = "https://pypi.org/simple;
>> verify_ssl = true
>> name = "pypi"
>>
>> [packages]
>> channels = "==2.1.7"
>> channels-redis = "==2.3.3"
>> daphne = "==2.2.5"
>> django = "==2.1.7"
>> django-redis = "==4.10.0"
>> gunicorn = "==19.9.0"
>> psycopg2-binary = "==2.8.1"
>>
>> [requires]
>> python_version = "3.7"
>>
>>
>>
>>

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e677848d-1389-4680-ab1d-0ea02c91e725%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


problems with url and views - new to django

2019-04-21 Thread Rob W
setting up a new project.
all good, loaded up the project on localhost.

however, when creating a view then setting the url, it doesn't work.


*urls.py*

from django.contrib import admin
from django.urls import path

urlpatterns = [
path('admin/', admin.site.urls),
path('hello/', lct_app.site.urls),
   

*views.py*

from django.shortcuts import render

def hello(request):
   return render(request, "lct_app/templates/hello.html", {})

i comment out the path in urls.py, django comes back. what am i missing?



-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4872beca-597c-4689-a12e-9e888c5266ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: want to Implement Inline editing in Django.. see this link(https://editor.datatables.net/examples/inline-editing/submitButton.html) want the some help with code. Thanks

2019-04-21 Thread iakash95768


On Sunday, April 21, 2019 at 11:21:56 PM UTC+5:30, iakas...@gmail.com wrote:
>
> http://django-datatable-view.appspot.com/x-editable-columns/ got an 
> example which is implemented in Django but failed to understand the code.
>



Need help in implementation.  

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e6a2287b-dbc9-47b9-88d1-3a7039192f3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: want to Implement Inline editing in Django.. see this link(https://editor.datatables.net/examples/inline-editing/submitButton.html) want the some help with code. Thanks

2019-04-21 Thread iakash95768
http://django-datatable-view.appspot.com/x-editable-columns/ got an example 
which is implemented in Django but failed to understand the code.

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/79c81241-d3e9-48b4-9c57-4f89b5700d98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: url not redirecting?

2019-04-21 Thread silverstrings026
I fixed it, none of the suggestions worked. 

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cae2c142-b363-4b9b-9c8f-27650105b39c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: url not redirecting?

2019-04-21 Thread silverstrings026
**FIXED**

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/99a54638-2b8a-46a3-ba45-fa4fb327f089%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing HTML in DB using DJANGO

2019-04-21 Thread Sipum Mishra
thank you all guys for suggesting.

can I plz get any tutorial for these so that I can learn that properly.

On Sun, 21 Apr 2019 at 21:34, Joel Mathew  wrote:

> I fail to see the purpose of that. Serialisation is sufficient. Big
> projects like wordpress store even big blog posts, which is html like this.
> Sincerely yours,
>
>  Joel G Mathew
>
>
>
> On Sun, 21 Apr 2019 at 20:20, Brian M  wrote:
>
>> What if you convert the html to an array of bytes before storing?
>>
>> Then you’d convert from bytes array back to string when you retrieve.
>> This way you’d store raw data.
>>
>>
>> On Apr 21, 2019, at 8:41 AM, Jani Tiainen  wrote:
>>
>> Well after all, HTML is just plain text... Though you probably want to
>> think to do some sanitization so you won't get nasty injections via html.
>>
>> On Sat, Apr 20, 2019 at 9:09 PM Sipum Mishra  wrote:
>>
>>> Hi friends,
>>>
>>> I want to store a html in database using python and need to retrieve
>>> that html and convert that in to PDF.
>>> can u plz suggest me how to store that HTML in DB ?
>>>
>>> --
>>> 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 django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/f301b675-6587-434e-b25d-87de9d9fef10%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Jani Tiainen
>> Software wizard
>>
>> https://blog.jani.tiainen.cc/
>>
>> Always open for short term jobs or contracts to work with Django.
>>
>> --
>> 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 django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHn91oe6hUWZtEYCx%3D8uNe%3DFEphZ4C_VRPv74oK2E-x9gvJjGw%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> 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 django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/47B36FA2-099C-4AAB-B5DA-1D9662513398%40gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAA%3Diw_-pMCYKd4_7CHbcU7jz7YFZmNw3BXd6Grgwa99x6WGALg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGHZBzz-%3Dca7eKzn-WD%3DVwhYG9J-OgAMXsWUm3gO3H52-JWxkA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing HTML in DB using DJANGO

2019-04-21 Thread Joel Mathew
I fail to see the purpose of that. Serialisation is sufficient. Big
projects like wordpress store even big blog posts, which is html like this.
Sincerely yours,

 Joel G Mathew



On Sun, 21 Apr 2019 at 20:20, Brian M  wrote:

> What if you convert the html to an array of bytes before storing?
>
> Then you’d convert from bytes array back to string when you retrieve. This
> way you’d store raw data.
>
>
> On Apr 21, 2019, at 8:41 AM, Jani Tiainen  wrote:
>
> Well after all, HTML is just plain text... Though you probably want to
> think to do some sanitization so you won't get nasty injections via html.
>
> On Sat, Apr 20, 2019 at 9:09 PM Sipum Mishra  wrote:
>
>> Hi friends,
>>
>> I want to store a html in database using python and need to retrieve that
>> html and convert that in to PDF.
>> can u plz suggest me how to store that HTML in DB ?
>>
>> --
>> 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 django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/f301b675-6587-434e-b25d-87de9d9fef10%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Jani Tiainen
> Software wizard
>
> https://blog.jani.tiainen.cc/
>
> Always open for short term jobs or contracts to work with Django.
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHn91oe6hUWZtEYCx%3D8uNe%3DFEphZ4C_VRPv74oK2E-x9gvJjGw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/47B36FA2-099C-4AAB-B5DA-1D9662513398%40gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA%3Diw_-pMCYKd4_7CHbcU7jz7YFZmNw3BXd6Grgwa99x6WGALg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: url not redirecting?

2019-04-21 Thread silverstrings026
It took away my public_posts page and replaced it for my home page. 

On Sunday, April 21, 2019 at 10:48:09 AM UTC-4, Victor H. Velasquez Rizo 
wrote:
>
> *Hello Silver.*
>
> *- On your URLCONFIG add *
> path('', include('public_posts.urls')),*<=== Add*
>
> -* On your  public_posts/urls.py add*
> app_name = 'public_posts'
> urlpatterns = [
> path('', views.pub_post_list, name='pub_posts'),
> path('', views.post_new, name='new_post'),
> path('new-post/', TemplateView.as_view(template_name='new_post.html'),
>  name='new_post'),   *<=== Change*
> path('', TemplateView.as_view(template_name='pub_posts.html'), name=
> 'pub_posts'),
> ]
>
> - On your HTML add
> New Post*<=== 
> Change*
>
> try and let me know if that 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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/922a05fe-f593-4595-bab1-f376cf4035e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Chat Help

2019-04-21 Thread PARTH PATIL
You can refer to this video tutorial, I found this pretty useful.

https://youtu.be/Wv5jlmJs2sU

This uses django channels to implement a asynchronous chat app.


Best Regards,
PARTH PATIL

On Sun, 21 Apr 2019, 8:20 pm Fahad Bin Munir,  wrote:

> how to create chatting system using api in djano?
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/398fbc6b-aaf7-4d2f-8107-6ea7ec1c2b81%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJSC-ien%3DqK1zdWGJv9L-t1mgr1TLwEtXtw1yhxKqpsr91bkBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: url not redirecting?

2019-04-21 Thread silverstrings026
That just swapped my home page for public_posts and took away the link ' 
New Post'

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9617b1b4-1815-468f-bbe6-601059540d9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: url not redirecting?

2019-04-21 Thread silverstrings026
Forgot to add that one of the pub_posts is now public_posts, still doesn't 
work but thanks for pointing out the fact that it is probably pretty stupid 
to have more than one thing with the same name, probably saved me a good 
amount of future headaches.

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9a7dcdf5-9bb2-4964-99b5-632134536a35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: url not redirecting?

2019-04-21 Thread silverstrings026
Didnt't work, changed to: (pub_posts
urlpatterns = [
path('', views.pub_post_list, name='pub_posts'),
path('', views.post_new, name='post_new'),
path('', TemplateView.as_view(template_name='new_post.html'), name=
'new_post'),
path('', TemplateView.as_view(template_name='pub_posts.html'), name=
'pub_posts'),
]




On Sunday, April 21, 2019 at 10:45:30 AM UTC-4, Gil Obradors wrote:
>
> Hi!
> You have two entrys with same name
>
> path('', views.post_new, name='new_post'),
> path('', TemplateView.as_view(template_name='new_post.html'), name=
> 'new_post'),
>
> Try to change one
>
>
> Regards
>
> El dg., 21 d’abr. 2019, 16:18, > va 
> escriure:
>
>> Hello, i'm attempting to redirect to a 'new post' page when someone 
>> clicks 'New Post'. Problem is, it redirects back to the public_posts page. 
>> the url in my HTML is {%  url 'new_post' %} but when i inspect the element 
>> in my browser, it says the href=/public_posts/ and no matter what I do, I 
>> can't get it to redirect/link correctly.
>>
>>
>> *RELEVANT FILES*
>>
>> #public_posts/forms.py
>>
>>
>>
>> from django import forms
>> from .models import Post
>>
>> class PublicPostForm(forms.ModelForm):
>>
>> class Meta:
>> model = Post
>> fields = ('title', 'text',)
>>
>>
>>
>> #public_posts/urls.py
>>
>>
>> from django.urls import path
>> from django.conf.urls import url
>> from . import views
>> from django.views.generic import TemplateView
>>
>> urlpatterns = [
>> path('', views.pub_post_list, name='pub_posts'),
>> path('', views.post_new, name='new_post'),
>> path('', TemplateView.as_view(template_name='new_post.html'), name=
>> 'new_post'),
>> path('', TemplateView.as_view(template_name='pub_posts.html'), name=
>> 'pub_posts'),
>> ]
>>
>>
>>
>> #public_posts/views.py
>>
>>
>> from django.shortcuts import render
>> from django.utils import timezone
>> from .models import Post
>> from django.urls import reverse_lazy
>> from django.views import generic
>> from django.http import HttpResponseRedirect
>> from django.shortcuts import render
>> from .forms import PublicPostForm
>>
>> # Create your views here.
>>
>> def pub_post_list(request):
>> 
>> posts = Post.objects.filter(published_date__lte=timezone.now()).
>> order_by('published_date')
>> return render(request, 'public_posts/pub_posts.html', {'posts': posts
>> })
>>
>> def post_new(request):
>> form = PublicPostForm()
>> posts = Post.objects.filter(published_date__lte=timezone.now()).
>> order_by('published_date')
>>
>> #if this is a POST request we need to process the form data
>>
>> if request.method == 'POST':
>> # create a form instance and populate it with data from the 
>> request:
>> form = PublicPostForm(request.POST)
>> # check whether it's valid:
>> if form.is_valid():
>> # process the data in form.cleaned_data as required
>> post.publish()
>> post.save()
>> 
>> # redirect to a new URL:
>> #return HttpResponseRedirect('/new_post/') Commented out to 
>> try render()
>> return render(request, 'public_posts/new_post.html', {'form': 
>> form})
>>
>> # if a GET (or any other method) we'll create a blank form
>> else:
>> form = PublicPostForm()
>> return render(request,  'public_posts/new_post.html', {'posts': posts
>> }) 
>>
>>
>>
>>
>> #public_posts/models.py
>>
>>
>> from django.conf import settings
>> from django.db import models
>> from django.utils import timezone
>> from django.utils.http import urlquote
>> from django.utils.translation import ugettext_lazy as _
>> from django.core.mail import send_mail
>> from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
>> from django.contrib.auth.models import BaseUserManager
>> from django.contrib.auth import get_user_model
>>
>>
>> User = get_user_model()
>>
>>
>> class Post(models.Model):
>> author = models.ForeignKey(User, related_name='pub_poster', on_delete
>> =models.CASCADE)
>> title = models.CharField(max_length=200)
>> text = models.TextField()
>> created_date = models.DateTimeField(default=timezone.now)
>> published_date = models.DateTimeField(blank=True, null=True)
>>
>> def publish(self):
>> self.published_date = timezone.now()
>> self.save()
>>
>> def __str__(self):
>> return self.title
>>
>> *URLCONFIG*
>>
>> from django.contrib import admin
>> from django.urls import path, include, resolve
>> from django.conf.urls import url
>> from admin_posts.views import home
>> from public_posts.views import post_new, pub_post_list
>> from django.views.generic.base import TemplateView
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('', home, name='home'),
>> path('admin_posts/', include('admin_posts.urls')),
>> path('', pub_post_list, name='pub_posts'),
>> path('', post_new, name='post_new'),
>> path('public_posts/', 

Re: Storing HTML in DB using DJANGO

2019-04-21 Thread Brian M
What if you convert the html to an array of bytes before storing? 

Then you’d convert from bytes array back to string when you retrieve. This way 
you’d store raw data.


> On Apr 21, 2019, at 8:41 AM, Jani Tiainen  wrote:
> 
> Well after all, HTML is just plain text... Though you probably want to think 
> to do some sanitization so you won't get nasty injections via html.
> 
>> On Sat, Apr 20, 2019 at 9:09 PM Sipum Mishra  wrote:
>> Hi friends,
>> 
>> I want to store a html in database using python and need to retrieve that 
>> html and convert that in to PDF.
>> can u plz suggest me how to store that HTML in DB ?
>> -- 
>> 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 django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f301b675-6587-434e-b25d-87de9d9fef10%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> Jani Tiainen
> Software wizard
> 
> https://blog.jani.tiainen.cc/
> 
> Always open for short term jobs or contracts to work with Django.
> -- 
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAHn91oe6hUWZtEYCx%3D8uNe%3DFEphZ4C_VRPv74oK2E-x9gvJjGw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/47B36FA2-099C-4AAB-B5DA-1D9662513398%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Chat Help

2019-04-21 Thread Fahad Bin Munir
how to create chatting system using api in djano?

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/398fbc6b-aaf7-4d2f-8107-6ea7ec1c2b81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: url not redirecting?

2019-04-21 Thread Victor H. Velasquez Rizo
*Hello Silver.*

*- On your URLCONFIG add *
path('', include('public_posts.urls')),*<=== Add*

-* On your  public_posts/urls.py add*
app_name = 'public_posts'
urlpatterns = [
path('', views.pub_post_list, name='pub_posts'),
path('', views.post_new, name='new_post'),
path('new-post/', TemplateView.as_view(template_name='new_post.html'),
 name='new_post'),   *<=== Change*
path('', TemplateView.as_view(template_name='pub_posts.html'), name=
'pub_posts'),
]

- On your HTML add
New Post*<===
Change*

try and let me know if that works.


On Sun, Apr 21, 2019 at 9:18 AM  wrote:

> Hello, i'm attempting to redirect to a 'new post' page when someone clicks
> 'New Post'. Problem is, it redirects back to the public_posts page. the url
> in my HTML is {%  url 'new_post' %} but when i inspect the element in my
> browser, it says the href=/public_posts/ and no matter what I do, I can't
> get it to redirect/link correctly.
>
>
> *RELEVANT FILES*
>
> #public_posts/forms.py
>
>
>
> from django import forms
> from .models import Post
>
> class PublicPostForm(forms.ModelForm):
>
> class Meta:
> model = Post
> fields = ('title', 'text',)
>
>
>
> #public_posts/urls.py
>
>
> from django.urls import path
> from django.conf.urls import url
> from . import views
> from django.views.generic import TemplateView
>
> urlpatterns = [
> path('', views.pub_post_list, name='pub_posts'),
> path('', views.post_new, name='new_post'),
> path('', TemplateView.as_view(template_name='new_post.html'), name=
> 'new_post'),
> path('', TemplateView.as_view(template_name='pub_posts.html'), name=
> 'pub_posts'),
> ]
>
>
>
> #public_posts/views.py
>
>
> from django.shortcuts import render
> from django.utils import timezone
> from .models import Post
> from django.urls import reverse_lazy
> from django.views import generic
> from django.http import HttpResponseRedirect
> from django.shortcuts import render
> from .forms import PublicPostForm
>
> # Create your views here.
>
> def pub_post_list(request):
>
> posts = Post.objects.filter(published_date__lte=timezone.now()).
> order_by('published_date')
> return render(request, 'public_posts/pub_posts.html', {'posts': posts
> })
>
> def post_new(request):
> form = PublicPostForm()
> posts = Post.objects.filter(published_date__lte=timezone.now()).
> order_by('published_date')
>
> #if this is a POST request we need to process the form data
>
> if request.method == 'POST':
> # create a form instance and populate it with data from the
> request:
> form = PublicPostForm(request.POST)
> # check whether it's valid:
> if form.is_valid():
> # process the data in form.cleaned_data as required
> post.publish()
> post.save()
>
> # redirect to a new URL:
> #return HttpResponseRedirect('/new_post/') Commented out to
> try render()
> return render(request, 'public_posts/new_post.html', {'form':
> form})
>
> # if a GET (or any other method) we'll create a blank form
> else:
> form = PublicPostForm()
> return render(request,  'public_posts/new_post.html', {'posts': posts
> })
>
>
>
>
> #public_posts/models.py
>
>
> from django.conf import settings
> from django.db import models
> from django.utils import timezone
> from django.utils.http import urlquote
> from django.utils.translation import ugettext_lazy as _
> from django.core.mail import send_mail
> from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
> from django.contrib.auth.models import BaseUserManager
> from django.contrib.auth import get_user_model
>
>
> User = get_user_model()
>
>
> class Post(models.Model):
> author = models.ForeignKey(User, related_name='pub_poster', on_delete=
> models.CASCADE)
> title = models.CharField(max_length=200)
> text = models.TextField()
> created_date = models.DateTimeField(default=timezone.now)
> published_date = models.DateTimeField(blank=True, null=True)
>
> def publish(self):
> self.published_date = timezone.now()
> self.save()
>
> def __str__(self):
> return self.title
>
> *URLCONFIG*
>
> from django.contrib import admin
> from django.urls import path, include, resolve
> from django.conf.urls import url
> from admin_posts.views import home
> from public_posts.views import post_new, pub_post_list
> from django.views.generic.base import TemplateView
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('', home, name='home'),
> path('admin_posts/', include('admin_posts.urls')),
> path('', pub_post_list, name='pub_posts'),
> path('', post_new, name='post_new'),
> path('public_posts/', include('public_posts.urls')),
> url(r'^accounts/', include('allauth.urls')),
> path('users/', include('users.urls')),
>
> ]
>
>
>
>
>
> REVELANT HTML
>
>
>
> 
> New Post
> 
>
>
>
>
>
>
>
> --
> You 

Re: url not redirecting?

2019-04-21 Thread Gil Obradors
Hi!
You have two entrys with same name

path('', views.post_new, name='new_post'),
path('', TemplateView.as_view(template_name='new_post.html'), name=
'new_post'),

Try to change one


Regards

El dg., 21 d’abr. 2019, 16:18,  va escriure:

> Hello, i'm attempting to redirect to a 'new post' page when someone clicks
> 'New Post'. Problem is, it redirects back to the public_posts page. the url
> in my HTML is {%  url 'new_post' %} but when i inspect the element in my
> browser, it says the href=/public_posts/ and no matter what I do, I can't
> get it to redirect/link correctly.
>
>
> *RELEVANT FILES*
>
> #public_posts/forms.py
>
>
>
> from django import forms
> from .models import Post
>
> class PublicPostForm(forms.ModelForm):
>
> class Meta:
> model = Post
> fields = ('title', 'text',)
>
>
>
> #public_posts/urls.py
>
>
> from django.urls import path
> from django.conf.urls import url
> from . import views
> from django.views.generic import TemplateView
>
> urlpatterns = [
> path('', views.pub_post_list, name='pub_posts'),
> path('', views.post_new, name='new_post'),
> path('', TemplateView.as_view(template_name='new_post.html'), name=
> 'new_post'),
> path('', TemplateView.as_view(template_name='pub_posts.html'), name=
> 'pub_posts'),
> ]
>
>
>
> #public_posts/views.py
>
>
> from django.shortcuts import render
> from django.utils import timezone
> from .models import Post
> from django.urls import reverse_lazy
> from django.views import generic
> from django.http import HttpResponseRedirect
> from django.shortcuts import render
> from .forms import PublicPostForm
>
> # Create your views here.
>
> def pub_post_list(request):
>
> posts = Post.objects.filter(published_date__lte=timezone.now()).
> order_by('published_date')
> return render(request, 'public_posts/pub_posts.html', {'posts': posts
> })
>
> def post_new(request):
> form = PublicPostForm()
> posts = Post.objects.filter(published_date__lte=timezone.now()).
> order_by('published_date')
>
> #if this is a POST request we need to process the form data
>
> if request.method == 'POST':
> # create a form instance and populate it with data from the
> request:
> form = PublicPostForm(request.POST)
> # check whether it's valid:
> if form.is_valid():
> # process the data in form.cleaned_data as required
> post.publish()
> post.save()
>
> # redirect to a new URL:
> #return HttpResponseRedirect('/new_post/') Commented out to
> try render()
> return render(request, 'public_posts/new_post.html', {'form':
> form})
>
> # if a GET (or any other method) we'll create a blank form
> else:
> form = PublicPostForm()
> return render(request,  'public_posts/new_post.html', {'posts': posts
> })
>
>
>
>
> #public_posts/models.py
>
>
> from django.conf import settings
> from django.db import models
> from django.utils import timezone
> from django.utils.http import urlquote
> from django.utils.translation import ugettext_lazy as _
> from django.core.mail import send_mail
> from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
> from django.contrib.auth.models import BaseUserManager
> from django.contrib.auth import get_user_model
>
>
> User = get_user_model()
>
>
> class Post(models.Model):
> author = models.ForeignKey(User, related_name='pub_poster', on_delete=
> models.CASCADE)
> title = models.CharField(max_length=200)
> text = models.TextField()
> created_date = models.DateTimeField(default=timezone.now)
> published_date = models.DateTimeField(blank=True, null=True)
>
> def publish(self):
> self.published_date = timezone.now()
> self.save()
>
> def __str__(self):
> return self.title
>
> *URLCONFIG*
>
> from django.contrib import admin
> from django.urls import path, include, resolve
> from django.conf.urls import url
> from admin_posts.views import home
> from public_posts.views import post_new, pub_post_list
> from django.views.generic.base import TemplateView
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('', home, name='home'),
> path('admin_posts/', include('admin_posts.urls')),
> path('', pub_post_list, name='pub_posts'),
> path('', post_new, name='post_new'),
> path('public_posts/', include('public_posts.urls')),
> url(r'^accounts/', include('allauth.urls')),
> path('users/', include('users.urls')),
>
> ]
>
>
>
>
>
> REVELANT HTML
>
>
>
> 
> New Post
> 
>
>
>
>
>
>
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To 

url not redirecting?

2019-04-21 Thread silverstrings026
Hello, i'm attempting to redirect to a 'new post' page when someone clicks 
'New Post'. Problem is, it redirects back to the public_posts page. the url 
in my HTML is {%  url 'new_post' %} but when i inspect the element in my 
browser, it says the href=/public_posts/ and no matter what I do, I can't 
get it to redirect/link correctly.


*RELEVANT FILES*

#public_posts/forms.py



from django import forms
from .models import Post

class PublicPostForm(forms.ModelForm):

class Meta:
model = Post
fields = ('title', 'text',)



#public_posts/urls.py


from django.urls import path
from django.conf.urls import url
from . import views
from django.views.generic import TemplateView

urlpatterns = [
path('', views.pub_post_list, name='pub_posts'),
path('', views.post_new, name='new_post'),
path('', TemplateView.as_view(template_name='new_post.html'), name=
'new_post'),
path('', TemplateView.as_view(template_name='pub_posts.html'), name=
'pub_posts'),
]



#public_posts/views.py


from django.shortcuts import render
from django.utils import timezone
from .models import Post
from django.urls import reverse_lazy
from django.views import generic
from django.http import HttpResponseRedirect
from django.shortcuts import render
from .forms import PublicPostForm

# Create your views here.

def pub_post_list(request):

posts = Post.objects.filter(published_date__lte=timezone.now()).order_by
('published_date')
return render(request, 'public_posts/pub_posts.html', {'posts': posts})

def post_new(request):
form = PublicPostForm()
posts = Post.objects.filter(published_date__lte=timezone.now()).order_by
('published_date')

#if this is a POST request we need to process the form data

if request.method == 'POST':
# create a form instance and populate it with data from the request:
form = PublicPostForm(request.POST)
# check whether it's valid:
if form.is_valid():
# process the data in form.cleaned_data as required
post.publish()
post.save()

# redirect to a new URL:
#return HttpResponseRedirect('/new_post/') Commented out to try 
render()
return render(request, 'public_posts/new_post.html', {'form': 
form})

# if a GET (or any other method) we'll create a blank form
else:
form = PublicPostForm()
return render(request,  'public_posts/new_post.html', {'posts': posts}) 




#public_posts/models.py


from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.http import urlquote
from django.utils.translation import ugettext_lazy as _
from django.core.mail import send_mail
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from django.contrib.auth.models import BaseUserManager
from django.contrib.auth import get_user_model


User = get_user_model()


class Post(models.Model):
author = models.ForeignKey(User, related_name='pub_poster', on_delete=
models.CASCADE)
title = models.CharField(max_length=200)
text = models.TextField()
created_date = models.DateTimeField(default=timezone.now)
published_date = models.DateTimeField(blank=True, null=True)

def publish(self):
self.published_date = timezone.now()
self.save()

def __str__(self):
return self.title

*URLCONFIG*

from django.contrib import admin
from django.urls import path, include, resolve
from django.conf.urls import url
from admin_posts.views import home
from public_posts.views import post_new, pub_post_list
from django.views.generic.base import TemplateView

urlpatterns = [
path('admin/', admin.site.urls),
path('', home, name='home'),
path('admin_posts/', include('admin_posts.urls')),
path('', pub_post_list, name='pub_posts'),
path('', post_new, name='post_new'),
path('public_posts/', include('public_posts.urls')),
url(r'^accounts/', include('allauth.urls')),
path('users/', include('users.urls')),

]





REVELANT HTML




New Post








-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/223a713a-d980-4e98-8b3a-ef58553a3ec1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing HTML in DB using DJANGO

2019-04-21 Thread Jani Tiainen
Well after all, HTML is just plain text... Though you probably want to
think to do some sanitization so you won't get nasty injections via html.

On Sat, Apr 20, 2019 at 9:09 PM Sipum Mishra  wrote:

> Hi friends,
>
> I want to store a html in database using python and need to retrieve that
> html and convert that in to PDF.
> can u plz suggest me how to store that HTML in DB ?
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f301b675-6587-434e-b25d-87de9d9fef10%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen
Software wizard

https://blog.jani.tiainen.cc/

Always open for short term jobs or contracts to work with Django.

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oe6hUWZtEYCx%3D8uNe%3DFEphZ4C_VRPv74oK2E-x9gvJjGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django - always getting False in form.is_valid()

2019-04-21 Thread Sipum Mishra
Hi Jani, the above solution is not working, still having the same problem.

and that completed field is used later for cross_off and uncross the item
in list.

On Sun, 21 Apr 2019 at 17:36, Jani Tiainen  wrote:

> Hi,
>
> required attribute works in forms, not in models. For models fields that
> are not required in forms you need to use blank=True.
>
> Though that's not the right solution.
>
> Why are you including "completed" field in a form (which you validate for
> user input) if you are not going to have such a input (checkbox) in a form?
>
>
> On Sun, Apr 21, 2019 at 3:02 PM Sipum Mishra  wrote:
>
>> if i do changes as above in model then it throws error like -
>>
>>  class List(models.Model):
>>   File "F:\django\to_do_list\todo\models.py", line 6, in List
>> completed = models.BooleanField(required=False)
>> TypeError: __init__() got an unexpected keyword argument 'required'
>>
>>
>> On Sun, 21 Apr 2019 at 17:27, Sipum Mishra  wrote:
>>
>>> Jani, Do you mean I need to change completed field in model like as
>>> below ?
>>>
>>> completed = models.BooleanField(default=False,required=False)
>>>
>>> On Sun, 21 Apr 2019 at 17:23, Sipum Mishra  wrote:
>>>
 Hi Jani,
 form.errors gives error as -

 itemThis field is
 required.<
 /li>

 can u plz tell me where i did wrong?

 On Sun, 21 Apr 2019 at 16:43, Jani Tiainen  wrote:

> completed is a required field and you're not passing any value with
> it. If you print form.errors you would should see that it complains about
> "completed" "this field is required"
>
> Note that providing default value in a model is not same as making
> field optional.
>
> On Fri, Apr 19, 2019 at 2:05 PM Sipum Mishra 
> wrote:
>
>> Hi All,
>>
>> I am always getting - form.is_valid returning False. kindly check
>> where I am doing wrong.
>> please find below code.
>>
>>
>> views.py
>> ---
>> def home(request):
>>
>> if request.method == 'POST':
>> form = ListForm(request.POST or None)
>> print(form.is_valid(), "-->",request.POST['Item'])
>> print(form.errors)
>> print(form)
>> if form.is_valid():
>> form.save()
>> all_items = List.objects.all
>> messages.success(request, ('Item has been Added to the List!'))
>> return render(request,'home.html', {'all_items' : all_items})
>> else:
>> print("deba-->",request.POST)
>> return HttpResponse("Form is invalid!")
>> else:
>> all_items = List.objects.all
>> return render(request,'home.html', {'all_items' : all_items})
>>
>> -
>> form.py
>> -
>>
>> class ListForm(forms.ModelForm):
>> class Meta:
>> model = List
>> fields = ["item", "completed"]
>>
>>
>> 
>> model.py
>> -
>>
>> class List(models.Model):
>> item = models.CharField(max_length=200)
>> completed = models.BooleanField(default=False)
>>
>>
>> def __str__(self):
>> return self.item + '|' + str(self.completed)
>>
>> --
>> 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 django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4ca5e82d-f34b-4ab4-8f82-5be0dcdebecc%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Jani Tiainen
> Software wizard
>
> https://blog.jani.tiainen.cc/
>
> Always open for short term jobs or contracts to work with Django.
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHn91of6O55rPh6fJFDHQ1Pc2v5Lk%3DT8JtN1wS_4NVuP9vi3MA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
 --
>> You received this message because you are subscribed 

Re: Django - always getting False in form.is_valid()

2019-04-21 Thread Jani Tiainen
Hi,

required attribute works in forms, not in models. For models fields that
are not required in forms you need to use blank=True.

Though that's not the right solution.

Why are you including "completed" field in a form (which you validate for
user input) if you are not going to have such a input (checkbox) in a form?


On Sun, Apr 21, 2019 at 3:02 PM Sipum Mishra  wrote:

> if i do changes as above in model then it throws error like -
>
>  class List(models.Model):
>   File "F:\django\to_do_list\todo\models.py", line 6, in List
> completed = models.BooleanField(required=False)
> TypeError: __init__() got an unexpected keyword argument 'required'
>
>
> On Sun, 21 Apr 2019 at 17:27, Sipum Mishra  wrote:
>
>> Jani, Do you mean I need to change completed field in model like as below
>> ?
>>
>> completed = models.BooleanField(default=False,required=False)
>>
>> On Sun, 21 Apr 2019 at 17:23, Sipum Mishra  wrote:
>>
>>> Hi Jani,
>>> form.errors gives error as -
>>>
>>> itemThis field is
>>> required.<
>>> /li>
>>>
>>> can u plz tell me where i did wrong?
>>>
>>> On Sun, 21 Apr 2019 at 16:43, Jani Tiainen  wrote:
>>>
 completed is a required field and you're not passing any value with it.
 If you print form.errors you would should see that it complains about
 "completed" "this field is required"

 Note that providing default value in a model is not same as making
 field optional.

 On Fri, Apr 19, 2019 at 2:05 PM Sipum Mishra  wrote:

> Hi All,
>
> I am always getting - form.is_valid returning False. kindly check
> where I am doing wrong.
> please find below code.
>
>
> views.py
> ---
> def home(request):
>
> if request.method == 'POST':
> form = ListForm(request.POST or None)
> print(form.is_valid(), "-->",request.POST['Item'])
> print(form.errors)
> print(form)
> if form.is_valid():
> form.save()
> all_items = List.objects.all
> messages.success(request, ('Item has been Added to the List!'))
> return render(request,'home.html', {'all_items' : all_items})
> else:
> print("deba-->",request.POST)
> return HttpResponse("Form is invalid!")
> else:
> all_items = List.objects.all
> return render(request,'home.html', {'all_items' : all_items})
>
> -
> form.py
> -
>
> class ListForm(forms.ModelForm):
> class Meta:
> model = List
> fields = ["item", "completed"]
>
>
> 
> model.py
> -
>
> class List(models.Model):
> item = models.CharField(max_length=200)
> completed = models.BooleanField(default=False)
>
>
> def __str__(self):
> return self.item + '|' + str(self.completed)
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4ca5e82d-f34b-4ab4-8f82-5be0dcdebecc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


 --
 Jani Tiainen
 Software wizard

 https://blog.jani.tiainen.cc/

 Always open for short term jobs or contracts to work with Django.

 --
 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 django-users@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAHn91of6O55rPh6fJFDHQ1Pc2v5Lk%3DT8JtN1wS_4NVuP9vi3MA%40mail.gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> 

Re: Django - always getting False in form.is_valid()

2019-04-21 Thread Sipum Mishra
if i do changes as above in model then it throws error like -

 class List(models.Model):
  File "F:\django\to_do_list\todo\models.py", line 6, in List
completed = models.BooleanField(required=False)
TypeError: __init__() got an unexpected keyword argument 'required'


On Sun, 21 Apr 2019 at 17:27, Sipum Mishra  wrote:

> Jani, Do you mean I need to change completed field in model like as below ?
>
> completed = models.BooleanField(default=False,required=False)
>
> On Sun, 21 Apr 2019 at 17:23, Sipum Mishra  wrote:
>
>> Hi Jani,
>> form.errors gives error as -
>>
>> itemThis field is
>> required.<
>> /li>
>>
>> can u plz tell me where i did wrong?
>>
>> On Sun, 21 Apr 2019 at 16:43, Jani Tiainen  wrote:
>>
>>> completed is a required field and you're not passing any value with it.
>>> If you print form.errors you would should see that it complains about
>>> "completed" "this field is required"
>>>
>>> Note that providing default value in a model is not same as making field
>>> optional.
>>>
>>> On Fri, Apr 19, 2019 at 2:05 PM Sipum Mishra  wrote:
>>>
 Hi All,

 I am always getting - form.is_valid returning False. kindly check where
 I am doing wrong.
 please find below code.


 views.py
 ---
 def home(request):

 if request.method == 'POST':
 form = ListForm(request.POST or None)
 print(form.is_valid(), "-->",request.POST['Item'])
 print(form.errors)
 print(form)
 if form.is_valid():
 form.save()
 all_items = List.objects.all
 messages.success(request, ('Item has been Added to the List!'))
 return render(request,'home.html', {'all_items' : all_items})
 else:
 print("deba-->",request.POST)
 return HttpResponse("Form is invalid!")
 else:
 all_items = List.objects.all
 return render(request,'home.html', {'all_items' : all_items})

 -
 form.py
 -

 class ListForm(forms.ModelForm):
 class Meta:
 model = List
 fields = ["item", "completed"]


 
 model.py
 -

 class List(models.Model):
 item = models.CharField(max_length=200)
 completed = models.BooleanField(default=False)


 def __str__(self):
 return self.item + '|' + str(self.completed)

 --
 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 django-users@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/4ca5e82d-f34b-4ab4-8f82-5be0dcdebecc%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>> --
>>> Jani Tiainen
>>> Software wizard
>>>
>>> https://blog.jani.tiainen.cc/
>>>
>>> Always open for short term jobs or contracts to work with Django.
>>>
>>> --
>>> 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 django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAHn91of6O55rPh6fJFDHQ1Pc2v5Lk%3DT8JtN1wS_4NVuP9vi3MA%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGHZBzx5TL%2BNZ--kbY2XpypCdOf5YP0AikdrFDQQ-rgg1026ow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django - always getting False in form.is_valid()

2019-04-21 Thread Sipum Mishra
Jani, Do you mean I need to change completed field in model like as below ?

completed = models.BooleanField(default=False,required=False)

On Sun, 21 Apr 2019 at 17:23, Sipum Mishra  wrote:

> Hi Jani,
> form.errors gives error as -
>
> itemThis field is
> required.<
> /li>
>
> can u plz tell me where i did wrong?
>
> On Sun, 21 Apr 2019 at 16:43, Jani Tiainen  wrote:
>
>> completed is a required field and you're not passing any value with it.
>> If you print form.errors you would should see that it complains about
>> "completed" "this field is required"
>>
>> Note that providing default value in a model is not same as making field
>> optional.
>>
>> On Fri, Apr 19, 2019 at 2:05 PM Sipum Mishra  wrote:
>>
>>> Hi All,
>>>
>>> I am always getting - form.is_valid returning False. kindly check where
>>> I am doing wrong.
>>> please find below code.
>>>
>>>
>>> views.py
>>> ---
>>> def home(request):
>>>
>>> if request.method == 'POST':
>>> form = ListForm(request.POST or None)
>>> print(form.is_valid(), "-->",request.POST['Item'])
>>> print(form.errors)
>>> print(form)
>>> if form.is_valid():
>>> form.save()
>>> all_items = List.objects.all
>>> messages.success(request, ('Item has been Added to the List!'))
>>> return render(request,'home.html', {'all_items' : all_items})
>>> else:
>>> print("deba-->",request.POST)
>>> return HttpResponse("Form is invalid!")
>>> else:
>>> all_items = List.objects.all
>>> return render(request,'home.html', {'all_items' : all_items})
>>>
>>> -
>>> form.py
>>> -
>>>
>>> class ListForm(forms.ModelForm):
>>> class Meta:
>>> model = List
>>> fields = ["item", "completed"]
>>>
>>>
>>> 
>>> model.py
>>> -
>>>
>>> class List(models.Model):
>>> item = models.CharField(max_length=200)
>>> completed = models.BooleanField(default=False)
>>>
>>>
>>> def __str__(self):
>>> return self.item + '|' + str(self.completed)
>>>
>>> --
>>> 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 django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/4ca5e82d-f34b-4ab4-8f82-5be0dcdebecc%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Jani Tiainen
>> Software wizard
>>
>> https://blog.jani.tiainen.cc/
>>
>> Always open for short term jobs or contracts to work with Django.
>>
>> --
>> 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 django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHn91of6O55rPh6fJFDHQ1Pc2v5Lk%3DT8JtN1wS_4NVuP9vi3MA%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGHZBzyF%3D5mNty%2BKW4xmg_GvKO_RMQrDxp5O7Pkpg%2BnTZXLOXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django - always getting False in form.is_valid()

2019-04-21 Thread Sipum Mishra
Hi Jani,
form.errors gives error as -

itemThis field is
required.<
/li>

can u plz tell me where i did wrong?

On Sun, 21 Apr 2019 at 16:43, Jani Tiainen  wrote:

> completed is a required field and you're not passing any value with it. If
> you print form.errors you would should see that it complains about
> "completed" "this field is required"
>
> Note that providing default value in a model is not same as making field
> optional.
>
> On Fri, Apr 19, 2019 at 2:05 PM Sipum Mishra  wrote:
>
>> Hi All,
>>
>> I am always getting - form.is_valid returning False. kindly check where I
>> am doing wrong.
>> please find below code.
>>
>>
>> views.py
>> ---
>> def home(request):
>>
>> if request.method == 'POST':
>> form = ListForm(request.POST or None)
>> print(form.is_valid(), "-->",request.POST['Item'])
>> print(form.errors)
>> print(form)
>> if form.is_valid():
>> form.save()
>> all_items = List.objects.all
>> messages.success(request, ('Item has been Added to the List!'))
>> return render(request,'home.html', {'all_items' : all_items})
>> else:
>> print("deba-->",request.POST)
>> return HttpResponse("Form is invalid!")
>> else:
>> all_items = List.objects.all
>> return render(request,'home.html', {'all_items' : all_items})
>>
>> -
>> form.py
>> -
>>
>> class ListForm(forms.ModelForm):
>> class Meta:
>> model = List
>> fields = ["item", "completed"]
>>
>>
>> 
>> model.py
>> -
>>
>> class List(models.Model):
>> item = models.CharField(max_length=200)
>> completed = models.BooleanField(default=False)
>>
>>
>> def __str__(self):
>> return self.item + '|' + str(self.completed)
>>
>> --
>> 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 django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4ca5e82d-f34b-4ab4-8f82-5be0dcdebecc%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Jani Tiainen
> Software wizard
>
> https://blog.jani.tiainen.cc/
>
> Always open for short term jobs or contracts to work with Django.
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHn91of6O55rPh6fJFDHQ1Pc2v5Lk%3DT8JtN1wS_4NVuP9vi3MA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGHZBzxTPyWzT_5GJ3zPsvHmWPHQOka5uM2-yHq9tM4g8urQZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django - always getting False in form.is_valid()

2019-04-21 Thread Jani Tiainen
completed is a required field and you're not passing any value with it. If
you print form.errors you would should see that it complains about
"completed" "this field is required"

Note that providing default value in a model is not same as making field
optional.

On Fri, Apr 19, 2019 at 2:05 PM Sipum Mishra  wrote:

> Hi All,
>
> I am always getting - form.is_valid returning False. kindly check where I
> am doing wrong.
> please find below code.
>
>
> views.py
> ---
> def home(request):
>
> if request.method == 'POST':
> form = ListForm(request.POST or None)
> print(form.is_valid(), "-->",request.POST['Item'])
> print(form.errors)
> print(form)
> if form.is_valid():
> form.save()
> all_items = List.objects.all
> messages.success(request, ('Item has been Added to the List!'))
> return render(request,'home.html', {'all_items' : all_items})
> else:
> print("deba-->",request.POST)
> return HttpResponse("Form is invalid!")
> else:
> all_items = List.objects.all
> return render(request,'home.html', {'all_items' : all_items})
>
> -
> form.py
> -
>
> class ListForm(forms.ModelForm):
> class Meta:
> model = List
> fields = ["item", "completed"]
>
>
> 
> model.py
> -
>
> class List(models.Model):
> item = models.CharField(max_length=200)
> completed = models.BooleanField(default=False)
>
>
> def __str__(self):
> return self.item + '|' + str(self.completed)
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4ca5e82d-f34b-4ab4-8f82-5be0dcdebecc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen
Software wizard

https://blog.jani.tiainen.cc/

Always open for short term jobs or contracts to work with Django.

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91of6O55rPh6fJFDHQ1Pc2v5Lk%3DT8JtN1wS_4NVuP9vi3MA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advanced permissions and role creation

2019-04-21 Thread Joel Mathew
Thanks a lot, guys.

On Sun, 21 Apr, 2019, 3:58 PM Jani Tiainen,  wrote:

> Hi,
>
> We do in our applications pretty much same approach as Mike proposed in
> his post. It's relatively efficient and works for both, UI and application
> side pretty well and doesn't require building anything complex and pretty
> much everything you need is already built-in in Django.
>
>
>
> On Sun, Apr 21, 2019 at 5:12 AM Joel Mathew  wrote:
>
>> I have an application for a hospital. There, I should be able to assign
>> different roles like Doctor, Nurse, Attender, Auxillary Nurse, Pharmacist,
>> Store Manager etc, each of would be having specific access to seperate
>> areas (views), with some having restricted access. In addition, there are
>> other hospitals who would be having no access to another hospital's
>> records. All of these permissions should be customisable, and I should be
>> able to create additional roles and permission groups for specific areas
>> later (from within the application itself, in production). What would be
>> the best solution to use? Is there a middleware which works well. I don't
>> want to roll my own if I will be reinventing the wheel.
>>
>> Currently my application has no use permissions. But access to specific
>> hospitals is being restricted by a model whoch stores hospital name, and
>> user name.
>> Sincerely yours,
>>
>>  Joel G Mathew
>>
>> --
>> 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 django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAA%3Diw_9BrOEh4Ss3X0g_EnaFyp1XTXij5DoZvva_XxwKVzXsGQ%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Jani Tiainen
> Software wizard
>
> https://blog.jani.tiainen.cc/
>
> Always open for short term jobs or contracts to work with Django.
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHn91od2vbV7F0WwAVp6Eppqmmd5-NgZciO_04Tm%3D9x9FSJyvQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA%3Diw_-6cLiAfN1NHovdY4-Y_Wtz1KToMWW6zErNKAdXNOpm1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advanced permissions and role creation

2019-04-21 Thread Jani Tiainen
Hi,

We do in our applications pretty much same approach as Mike proposed in his
post. It's relatively efficient and works for both, UI and application side
pretty well and doesn't require building anything complex and pretty much
everything you need is already built-in in Django.



On Sun, Apr 21, 2019 at 5:12 AM Joel Mathew  wrote:

> I have an application for a hospital. There, I should be able to assign
> different roles like Doctor, Nurse, Attender, Auxillary Nurse, Pharmacist,
> Store Manager etc, each of would be having specific access to seperate
> areas (views), with some having restricted access. In addition, there are
> other hospitals who would be having no access to another hospital's
> records. All of these permissions should be customisable, and I should be
> able to create additional roles and permission groups for specific areas
> later (from within the application itself, in production). What would be
> the best solution to use? Is there a middleware which works well. I don't
> want to roll my own if I will be reinventing the wheel.
>
> Currently my application has no use permissions. But access to specific
> hospitals is being restricted by a model whoch stores hospital name, and
> user name.
> Sincerely yours,
>
>  Joel G Mathew
>
> --
> 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 django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAA%3Diw_9BrOEh4Ss3X0g_EnaFyp1XTXij5DoZvva_XxwKVzXsGQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen
Software wizard

https://blog.jani.tiainen.cc/

Always open for short term jobs or contracts to work with Django.

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91od2vbV7F0WwAVp6Eppqmmd5-NgZciO_04Tm%3D9x9FSJyvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


making bots with Django for instagram

2019-04-21 Thread Saeed Pooladzadeh
Hello

  Please if you have any experience or idea on making bots for instagram 
with django share with me.

thanx 

-- 
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 django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fe681a3d-4640-4d1f-90d1-fd39fc87d0b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.