Django sql raw query to queryset

2019-08-22 Thread Suraj Thapa FC
SELECT *
FROM course_review_report LEFT JOIN courses ON course_review_report.cid =
courses.cid


Can anyone pls write the querryset for the above sql query

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPjsHcFbqD%2BgX1NA8QLYFsJUkb9VydzzcBRrNO2FpCyAgS0nqw%40mail.gmail.com.


Re: Django is not working

2019-08-22 Thread Mike Dewhirst
Looking at the error below, I would recommend the following:

1. Upgrade pip

2. pip uninstall django

3. Reinstall the previous working version of Django and prove it is working

4. Restart the machine

5. Re-install Django 1.11.22

The traceback says it cannot find the contrib module which possibly means 
the upgrade to 1.11.22 didn't complete correctly the first time. 

Good luck

Mike

On Friday, August 23, 2019 at 7:45:00 AM UTC+10, Tom Gertin wrote:
>
> Hello, I have successfully install Django 1.11.22. However, I believe 
> something is wrong because I cannot get the command that lists its version 
> to work, in addition the manage.py help command also produces the same 
> error. Here is the error.
>
> $ pip install Django==1.11.22
> DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 
> 2020. Please upgrade your Python as Python 2.7 won't be maintained after 
> that date. A future version of pip will drop support for Python 2.7.
> Collecting Django==1.11.22
>   Using cached 
> https://files.pythonhosted.org/packages/70/22/237da71dc112f2bba335c18380bc403fba430c44cc4da088824e77652738/Django-1.11.22-py2.py3-none-any.whl
> Requirement already satisfied: pytz in 
> /home/ubuntu/.venv/my_geonode/lib/python2.7/site-packages (from 
> Django==1.11.22) (2019.1)
> Installing collected packages: Django
>   Found existing installation: Django 1.11.21
> Uninstalling Django-1.11.21:
>   Successfully uninstalled Django-1.11.21
> Successfully installed Django-1.11.22
> WARNING: You are using pip version 19.1.1, however version 19.2.2 is 
> available.
> You should consider upgrading via the 'pip install --upgrade pip' command.
> $ python -m django --version
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
> "__main__", fname, loader, pkg_name)
>   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
> exec code in run_globals
>   File 
> "/home/ubuntu/.venv/my_geonode/lib/python2.7/site-packages/django/__main__.py",
>  
> line 9, in 
> management.execute_from_command_line()
>   File 
> "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 364, in execute_from_command_line
> utility.execute()
>   File 
> "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 338, in execute
> django.setup()
>   File 
> "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/__init__.py",
>  
> line 27, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File 
> "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/apps/registry.py",
>  
> line 85, in populate
> app_config = AppConfig.create(entry)
>   File 
> "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/apps/config.py",
>  
> line 120, in create
> mod = import_module(mod_path)
>   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in 
> import_module
> __import__(name)
> ImportError: No module named contrib
>
> Help would be appreciated. Also, what is odd is that if I enter the python 
> console, I can import django and print out the version.
>
> Thanks,
>
> Tom
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/860ed78d-c46b-4350-8889-cb92cc18d211%40googlegroups.com.


Re: Django is not working

2019-08-22 Thread 'Akash Sinha' via Django users
You are using python 2.7 with Django , I will suggest you should use python 3.6 
or above.

Sent from Yahoo Mail on Android 
 
  On Fri, Aug 23, 2019 at 3:14 AM, Tom Gertin wrote:   
Hello, I have successfully install Django 1.11.22. However, I believe something 
is wrong because I cannot get the command that lists its version to work, in 
addition the manage.py help command also produces the same error. Here is the 
error.
$ pip install Django==1.11.22DEPRECATION: Python 2.7 will reach the end of its 
life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be 
maintained after that date. A future version of pip will drop support for 
Python 2.7.Collecting Django==1.11.22  Using cached 
https://files.pythonhosted.org/packages/70/22/237da71dc112f2bba335c18380bc403fba430c44cc4da088824e77652738/Django-1.11.22-py2.py3-none-any.whlRequirement
 already satisfied: pytz in 
/home/ubuntu/.venv/my_geonode/lib/python2.7/site-packages (from 
Django==1.11.22) (2019.1)Installing collected packages: Django  Found existing 
installation: Django 1.11.21    Uninstalling Django-1.11.21:      Successfully 
uninstalled Django-1.11.21Successfully installed Django-1.11.22WARNING: You are 
using pip version 19.1.1, however version 19.2.2 is available.You should 
consider upgrading via the 'pip install --upgrade pip' command.$ python -m 
django --versionTraceback (most recent call last):  File 
"/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main    "__main__", 
fname, loader, pkg_name)  File "/usr/lib/python2.7/runpy.py", line 72, in 
_run_code    exec code in run_globals  File 
"/home/ubuntu/.venv/my_geonode/lib/python2.7/site-packages/django/__main__.py", 
line 9, in     management.execute_from_command_line()  File 
"/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 line 364, in execute_from_command_line    utility.execute()  File 
"/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 line 338, in execute    django.setup()  File 
"/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/__init__.py",
 line 27, in setup    apps.populate(settings.INSTALLED_APPS)  File 
"/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/apps/registry.py",
 line 85, in populate    app_config = AppConfig.create(entry)  File 
"/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/apps/config.py",
 line 120, in create    mod = import_module(mod_path)  File 
"/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module    
__import__(name)ImportError: No module named contrib
Help would be appreciated. Also, what is odd is that if I enter the python 
console, I can import django and print out the version.
Thanks,
Tom

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/471a2ef7-8032-420f-8fd2-027f005d1d55%40googlegroups.com.
  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1485038449.1267586.1566533098549%40mail.yahoo.com.


Re: Django is not working

2019-08-22 Thread Gerardo Palazuelos Guerrero
hi Tom,
Not sure what exactly configuration you have, but text you sent says you
have python 2.7 and somehow a virtual environment (venv) is mentioned in
the stacktrace.
I don't use python 2.7, so my following suggestions considers a recent
version.

May i suggest you to check djangogirls for proper installation.
Also:
https://www.obeythetestinggoat.com/book/pre-requisite-installations.html
https://djangoforbeginners.com/initial-setup/

good luck.
--
Gerardo Palazuelos Guerrero



On Thu, Aug 22, 2019 at 3:44 PM Tom Gertin  wrote:

> Hello, I have successfully install Django 1.11.22. However, I believe
> something is wrong because I cannot get the command that lists its version
> to work, in addition the manage.py help command also produces the same
> error. Here is the error.
>
> $ pip install Django==1.11.22
> DEPRECATION: Python 2.7 will reach the end of its life on January 1st,
> 2020. Please upgrade your Python as Python 2.7 won't be maintained after
> that date. A future version of pip will drop support for Python 2.7.
> Collecting Django==1.11.22
>   Using cached
> https://files.pythonhosted.org/packages/70/22/237da71dc112f2bba335c18380bc403fba430c44cc4da088824e77652738/Django-1.11.22-py2.py3-none-any.whl
> Requirement already satisfied: pytz in
> /home/ubuntu/.venv/my_geonode/lib/python2.7/site-packages (from
> Django==1.11.22) (2019.1)
> Installing collected packages: Django
>   Found existing installation: Django 1.11.21
> Uninstalling Django-1.11.21:
>   Successfully uninstalled Django-1.11.21
> Successfully installed Django-1.11.22
> WARNING: You are using pip version 19.1.1, however version 19.2.2 is
> available.
> You should consider upgrading via the 'pip install --upgrade pip' command.
> $ python -m django --version
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
> "__main__", fname, loader, pkg_name)
>   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
> exec code in run_globals
>   File
> "/home/ubuntu/.venv/my_geonode/lib/python2.7/site-packages/django/__main__.py",
> line 9, in 
> management.execute_from_command_line()
>   File
> "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 364, in execute_from_command_line
> utility.execute()
>   File
> "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 338, in execute
> django.setup()
>   File
> "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/__init__.py",
> line 27, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File
> "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/apps/registry.py",
> line 85, in populate
> app_config = AppConfig.create(entry)
>   File
> "/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/apps/config.py",
> line 120, in create
> mod = import_module(mod_path)
>   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in
> import_module
> __import__(name)
> ImportError: No module named contrib
>
> Help would be appreciated. Also, what is odd is that if I enter the python
> console, I can import django and print out the version.
>
> Thanks,
>
> Tom
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/471a2ef7-8032-420f-8fd2-027f005d1d55%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJ8iCyMQbzs5n7g-eE%3D-WP475qQDVqcDzhSQRfzbJieb9iS2rQ%40mail.gmail.com.


Re:

2019-08-22 Thread Perceval Maturure
Tutorial on how to simply hook the app to the page

On Thu, 22 Aug 2019 at 23:49, Perceval Maturure 
wrote:

> Hi All
> My app is not displaying records from the database after hooking a page to
> an apphook. I can select the app from admin on the page but when I preview
> the page is empty,
> Can anyone share some simplified tutorial for Django version 2.1 and
> Djangocms 3.6
> Regards
> Perceval
> --
> Sent from Gmail Mobile
>
-- 
Sent from Gmail Mobile

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFZtZmCsT7v7-q49isz60PSFbax4eZbP_ezhCgLR-PjtPXu%3D3g%40mail.gmail.com.


[no subject]

2019-08-22 Thread Perceval Maturure
Hi All
My app is not displaying records from the database after hooking a page to
an apphook. I can select the app from admin on the page but when I preview
the page is empty,
Can anyone share some simplified tutorial for Django version 2.1 and
Djangocms 3.6
Regards
Perceval
-- 
Sent from Gmail Mobile

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFZtZmCHMYdNit1gBaJvjTK-qc9En-F1U6CkoggOV724e-euiA%40mail.gmail.com.


Django is not working

2019-08-22 Thread Tom Gertin
Hello, I have successfully install Django 1.11.22. However, I believe 
something is wrong because I cannot get the command that lists its version 
to work, in addition the manage.py help command also produces the same 
error. Here is the error.

$ pip install Django==1.11.22
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 
2020. Please upgrade your Python as Python 2.7 won't be maintained after 
that date. A future version of pip will drop support for Python 2.7.
Collecting Django==1.11.22
  Using cached 
https://files.pythonhosted.org/packages/70/22/237da71dc112f2bba335c18380bc403fba430c44cc4da088824e77652738/Django-1.11.22-py2.py3-none-any.whl
Requirement already satisfied: pytz in 
/home/ubuntu/.venv/my_geonode/lib/python2.7/site-packages (from 
Django==1.11.22) (2019.1)
Installing collected packages: Django
  Found existing installation: Django 1.11.21
Uninstalling Django-1.11.21:
  Successfully uninstalled Django-1.11.21
Successfully installed Django-1.11.22
WARNING: You are using pip version 19.1.1, however version 19.2.2 is 
available.
You should consider upgrading via the 'pip install --upgrade pip' command.
$ python -m django --version
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
  File 
"/home/ubuntu/.venv/my_geonode/lib/python2.7/site-packages/django/__main__.py", 
line 9, in 
management.execute_from_command_line()
  File 
"/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 364, in execute_from_command_line
utility.execute()
  File 
"/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 338, in execute
django.setup()
  File 
"/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/__init__.py",
 
line 27, in setup
apps.populate(settings.INSTALLED_APPS)
  File 
"/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/apps/registry.py",
 
line 85, in populate
app_config = AppConfig.create(entry)
  File 
"/home/ubuntu/.venv/my_geonode/local/lib/python2.7/site-packages/django/apps/config.py",
 
line 120, in create
mod = import_module(mod_path)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named contrib

Help would be appreciated. Also, what is odd is that if I enter the python 
console, I can import django and print out the version.

Thanks,

Tom

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/471a2ef7-8032-420f-8fd2-027f005d1d55%40googlegroups.com.


Re: Hello, everybody! I've tried using FormMixin with DetailView and I get error 405 on post method. Can anybody help me? Thanks a lot.

2019-08-22 Thread James Schneider
Post the full error message and/or traceback reported by the server when
the error occurs.

-James

On Thu, Aug 22, 2019, 12:31 PM Catalina Popescu <
catalina.t.pope...@gmail.com> wrote:

> views.py
>
> class BookDisplay(DetailView):
> model = Book
> template_name = 'books/book_detail.html'
>
> def get_context_data(self, **kwargs):
> context = super().get_context_data(**kwargs)
> context['form'] = WishBookForm()
> return context
>
> class WishBook(SingleObjectMixin, FormView):
> form_class = WishBookForm()
> template_name = 'books/book_detail.html'
> model = Status
>
> def post(self, request):
> if not request.user.is_authenticated:
> return HttpResponseForbidden()
> self.object = self.get_object()
> return super().post(request)
>
> def get_success_url(self):
> return reverse('books/book_detail', kwargs = {'pk': self.object.pk
> })
>
>
> class BookDetail(View):
> def get(self, request):
> view = BookDisplay.as_view()
> return view(request)
>
> def post(self, request):
> view = WishBook.as_view()
> return view(request)
>
> forms.py
>
> class WishBookForm(forms.Form):
> status = forms.ChoiceField(choices=Status.GIVEAWAY_STATUS[:2],
> initial='Cu chef de ducă')
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/231fd7dc-3bf2-465c-993b-c476b0ca4dc1%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX1baRiKGuYZZcjdMeDyPpicaiqk9aP2fyLMnQEBFQdDw%40mail.gmail.com.


Re: form.is_valid() is always return false please help

2019-08-22 Thread Thomas Lockhart
Post your form code please.

- Tom

> On Aug 22, 2019, at 12:56 PM, Shubham Chauhan  
> wrote:
> 
> form.is_valid() is always return false please help 
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/206e042a-738b-4491-8f4d-9c172f61e56d%40googlegroups.com
>  
> .
> 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/12E7B9A4-E03E-4371-B6AA-1E97A8173C87%40gmail.com.


form.is_valid() is always return false please help

2019-08-22 Thread Shubham Chauhan
form.is_valid() is always return false please help 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/206e042a-738b-4491-8f4d-9c172f61e56d%40googlegroups.com.


Hello, everybody! I've tried using FormMixin with DetailView and I get error 405 on post method. Can anybody help me? Thanks a lot.

2019-08-22 Thread Catalina Popescu
views.py

class BookDisplay(DetailView):
model = Book
template_name = 'books/book_detail.html'

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['form'] = WishBookForm()
return context

class WishBook(SingleObjectMixin, FormView):
form_class = WishBookForm()
template_name = 'books/book_detail.html'
model = Status

def post(self, request):
if not request.user.is_authenticated:
return HttpResponseForbidden()
self.object = self.get_object()
return super().post(request)

def get_success_url(self):
return reverse('books/book_detail', kwargs = {'pk': self.object.pk})


class BookDetail(View):
def get(self, request):
view = BookDisplay.as_view()
return view(request)

def post(self, request):
view = WishBook.as_view()
return view(request)

forms.py

class WishBookForm(forms.Form):
status = forms.ChoiceField(choices=Status.GIVEAWAY_STATUS[:2], 
initial='Cu chef de ducă')


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/231fd7dc-3bf2-465c-993b-c476b0ca4dc1%40googlegroups.com.


Re: Reverse for 'modification' with no arguments not found issue

2019-08-22 Thread James Schneider
>
> lire.html
> ...
>type="button">Editer larequête
> ...
>
> urls.py
> path('edit/', views.view_modif, name='modification'),
> error :
> NoReverseMatch at /edit/1
>
> Reverse for 'modification' with no arguments not found. 1 pattern(s) tried: 
> ['edit/(?P[0-9]+)$']
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/edit/1
> Django Version: 2.0
> Exception Type: NoReverseMatch
> Exception Value:
>
> Reverse for 'modification' with no arguments not found. 1 pattern(s) tried: 
> ['edit/(?P[0-9]+)$']
>
> Exception Location: /usr/lib/python3.7/site-packages/django/urls/resolvers.py
> in _reverse_with_prefix, line 632
> Python Executable: /usr/bin/python
>



The error is saying you have no arguments to the {% url %} tag. Make sure
that req.id is actually resolving to an integer value.

Templates are fun when they mask missing values like that. You already have
it displayed earlier in the template. Comment out the {% url %} tag and see
if a number is displayed in your template.

-James

>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWV4K7%2BvTb8q8sGQBnbsY9t4srQK%2BH_NSZMCKSNp6KnAA%40mail.gmail.com.


Re: How can I host my application in web hosting?

2019-08-22 Thread Wasim Rana
Thank you so much for your response.
*Wasim Rana*

CEO and Director
*SiteFor99*
www.sitefor99.com
Cell: +880 173 406 4296
Ring Road, Shyamoli,
Dhaka - 1207


On Thu, Aug 22, 2019 at 5:55 PM Abu Yusuf 
wrote:

> Is it a django application? Not every hosting provider provide django
> deployments.
> You can use amazon aws and digital ocean. You can do also in heroku and
> pythonanywhere, they are totally free.
>
> On Thu, Aug 22, 2019 at 5:47 PM Wasim Rana  wrote:
>
>> Hello, I am building a web application locally in my computer. It's
>> almost done and I want to host it in Siteground hosting. How can I do that?
>> Please help.
>> Thanks
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/bfc3fc3d-0614-4588-8391-b3a64b1a151a%40googlegroups.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACNsr29ws9CDAEECAafFX6yBe6STcoPyGN-6WR1mGDWiENma4g%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALbNXK5Ky8qquFBML2tbxysfwwv%2BdrKteSQuh%2B9mGOWU1-1QVQ%40mail.gmail.com.


Reverse for 'modification' with no arguments not found issue

2019-08-22 Thread Ali IMRANE
Hello everyone,

I know I may ask this question for another time for some of you but after 
an hour of research, I'm still stuck with this issue of "No Reverse Match".

Here is my problem :

   - First, I using forms to put information in my DB (tickets) ;
   - I want to be able to edit those informations (check if a ticket has 
   been handled) ;
   - When I'm trying to call again my form to edit my information, even if 
   I give a specific ID, no way to reach it.


lire.html
...
{{ req.name }}
Soumis par moi le {{ req.fromd|date:"DATE_FORMAT" }}
  ID : {{ req.id }}
  Type de test : {{ req.typeOfTest }}
  Nom : {{ req.name }}
  Date de la requête : {{ req.fromd }}
  Périmètre : {{ req.perimetre }}
  Owner : {{ req.owner }}
Indice de compromission :{{ req.iocs|linebreaks 
}}
  Message à l'utilisateur :{{ 
req.messageToUser|linebreaks }}
  BAL Folder :{{ req.balFolder|linebreaks }}
  Note :{{ req.note|linebreaks }}
  Requête finie : {{ req.handled|linebreaks }}
  
  Editer larequête
...

views.py
def view_modif(request, id):
# Construit le formulaire, soit avec les données postées,
# soit vide si l'user accède pour la première fois à la page.
req = get_object_or_404(Requete, id=id)
form_m = RequeteFormEdit(instance=req)
# Verif que les données envoyées sont valides.
# Cette méthode renvoie False s'il n'y a pas de
# donnée dans le form ou qu'il contient des erreurs.
if form_m.is_valid():
# Ici, on traite les données du form
form_m.typeOfTest = form_m.cleaned_data['typeOfTest']
form_m.name = form_m.cleaned_data['name']
form_m.tod = timezone.now
form_m.perimetre = form_m.cleaned_data['perimetre']
form_m.owner = form_m.cleaned_data['owner']
form_m.iocs = form_m.cleaned_data['iocs']
form_m.messageToUser = form_m.cleaned_data['messageToUser']
form_m.balFolder = form_m.cleaned_data['balFolder']
# form_m.pj = form_m.cleaned_data['pj']
form_m.handler = form_m.cleaned_data['handler']
form_m.note = form_m.cleaned_data['handled']
form_m.handled = form_m.cleaned_data['note']

form_m.save()

# Nous pourrions ici envoyer l'e-mail grâce aux données
# que nous venons de récupérer
envoi = True
redirect(home)

# Quoiqu'il arrive, on affiche la page du formulaire.
return render(request, 'insertion/modification.html', locals())

urls.py
from django.urls import path
from . import views

urlpatterns = [
path('', views.home, name='home'),
path('liste', views.liste, name='liste'),
path('requete/', views.print_req, name='voir_req'),
path('insertion/', views.view_insert, name='insertion'),
path('edit/', views.view_modif, name='modification'),
path('connexion/', views.connexion, name='connexion'),
path('deconnexion/', views.deconnexion, name='deconnexion')
]

error :
NoReverseMatch at /edit/1

Reverse for 'modification' with no arguments not found. 1 pattern(s) tried: 
['edit/(?P[0-9]+)$']

Request Method: GET
Request URL: http://127.0.0.1:8000/edit/1
Django Version: 2.0
Exception Type: NoReverseMatch
Exception Value: 

Reverse for 'modification' with no arguments not found. 1 pattern(s) tried: 
['edit/(?P[0-9]+)$']

Exception Location: /usr/lib/python3.7/site-packages/django/urls/resolvers.py 
in _reverse_with_prefix, line 632
Python Executable: /usr/bin/python


I'm in a hurry and hope I could have the help I need thanks to you.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04ba18e5-46af-49d3-a13f-67fd95ecd1ee%40googlegroups.com.


Re: Chat bot sholud use API

2019-08-22 Thread Ezequias Rocha
I wouldn't do that. You will have too much effort to suppress this 
endeavour. Use Google Dialogflow and be happy.

On Thursday, August 22, 2019 at 10:57:07 AM UTC-3, UNIQ technologies wrote:
>
> Hi,
>
>
>
> I want to create a chatbot for my own website without any third party 
> Applicantions and should intract with my API'S and I have to use the 
> Options in chatbot like it should suggestions for response 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e078a8cd-34a4-468c-9e17-b8d74730af89%40googlegroups.com.


Re: Is there any ready to use Django script for user management like the UserCake or User Spice framework in PHP?

2019-08-22 Thread Vishal Parkar
Thank you very much, Derek!

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/96a05484-f860-4e5a-a831-56ce2717968a%40googlegroups.com.


Chat bot sholud use API

2019-08-22 Thread UNIQ technologies
Hi,



I want to create a chatbot for my own website without any third party
Applicantions and should intract with my API'S and I have to use the
Options in chatbot like it should suggestions for response

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACR8NakvsaJSZjsGhqGHzMt3jRekcbFfatudwDy6GbYjht1KJg%40mail.gmail.com.


Re: UI for python windows applications

2019-08-22 Thread Ezequias Rocha
disconsider.

On Thursday, August 22, 2019 at 10:36:11 AM UTC-3, Ezequias Rocha wrote:
>
> VSCode
>
> On Wednesday, August 21, 2019 at 2:46:57 PM UTC-3, ARAVIND BALAKRISHNAN 
> wrote:
>>
>> Can anyone suggest me any modern UIs for python application in windows 
>> other than electron
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/553daac0-a8c3-424f-a755-12d21975e52b%40googlegroups.com.


Re: UI for python windows applications

2019-08-22 Thread Ezequias Rocha
VSCode

On Wednesday, August 21, 2019 at 2:46:57 PM UTC-3, ARAVIND BALAKRISHNAN 
wrote:
>
> Can anyone suggest me any modern UIs for python application in windows 
> other than electron
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0109b897-0833-4b03-af88-c42ceec461c7%40googlegroups.com.


Re: UI for python windows applications

2019-08-22 Thread Mario R. Osorio

You might want to take a look into Kivy (https://kivy.org/ 
)

HTH


On Wednesday, August 21, 2019 at 1:46:57 PM UTC-4, ARAVIND BALAKRISHNAN 
wrote:
>
> Can anyone suggest me any modern UIs for python application in windows 
> other than electron
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7e6d689a-ba44-4703-a97d-262144933c08%40googlegroups.com.


Custom action with security

2019-08-22 Thread Ezequias Rocha
Hi everyone

I am using a custom action in admin, it is simple but not secure. I would 
like some custom actions would work only for some users and i think it 
could be done with a different url and a differente authorization role (in 
Admin).

Could you give me some advice to make this issue work on my admin in a 
different URL?

I am using Django-rest-framework.

My implementation was quite easy (but I need to have access to this action 
for some specific users in *Admin and Postman*).

model.py:
@action(methods=['put'], detail=True, permission_classes=[IsAdminUser], 
url_path='aprovarArtigo', url_name='aprovar_artigo')
def approveArtcle(modeladmin, request, queryset):
queryset.update(fl_approved=True)

@action(methods=['put'], detail=True, permission_classes=[IsAdminUser], 
url_path='desaprovarArtigo', url_name='desaprovar_artigo')
def disapproveArtcle(modeladmin, request, queryset):
queryset.update(fl_approved=False)

I tried to put the commented line to work but this simple not work.

model.py:
class AprovarArtigoAdmin(admin.ModelAdmin):
list_display = ('id', 'nu_usuario_id', 'de_titulo', 'de_texto', 
'fl_aprovado', 'dt_inclusao', 'dt_alteracao', 'nu_usuario_alteracao' )
readonly_fields = ['nu_usuario_alteracao', 'fl_aprovado']
actions = [approveArticle, disapproveArticle] 
approveArticle.short_description = "Approve selected Articles"
disapproveArticle.short_description = "Disapprove selected Articles"
list_filter = ('fl_approved',)

admin.site.register(Article, ArticleAdmin)
#admin.site.register(ApproveArticleAdmin,) 

I got the error:
*TypeError: 'MediaDefiningClass' object is not iterable*
Regards
Ezequias

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2dfe41b9-d79d-4750-82d7-564c28af43a3%40googlegroups.com.


Using Rest API i want to Put ImageField ie. ImageFile in Hadoop (HDFS)

2019-08-22 Thread Saurabh Dubey
So, I want to connect Django with Hadoop File system.
That is if I send the images from postman using POST Request in Django.
that data  will directly stored into HDFS (Hadoop Distribution file
system). send me some idea or solution for connection. and storage files in
hadoop using Django Rest API. send me some code for this or guid me.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BwsKJmLZRCOX7JSqm8EhgqE1Pa7pagbse78CGF-2j-8vzvJQw%40mail.gmail.com.


Re: Rest framework

2019-08-22 Thread Soumen Khatua
Hi Ahmed,
Here is my code:


*Views.py*








*class DatasetListAPIView(ListAPIView):serializer_class =
DatasetlSerializerdef get_queryset(self):qs =
Dataset.objects.all()word = self.request.query_params.get('word')
  if word is not None:qs  = qs.filter(name__icontains =
word).order_by(Length('name').asc(),'-hits')return qs
search_fields = ('name',)*

but if my end user type something like:

http://127.0.0.1:8000/search/?word = a

then I want to show some database match record suggestion like:

http://127.0.0.1:8000/search/?word = an
http://127.0.0.1:8000/search/?word = at
http://127.0.0.1:8000/search/?word = ant

I think I need to override inbuilt HTML and Javascript,But I don't know How
to do that Please tell me How I can do that.

Thank You for your response



Regards,
Soumen














On Thu, Aug 22, 2019 at 5:43 PM Ahmed Shahwan  wrote:

> you'll just create an endpoint that receives a query parameter with the
> string to search for, and you'll search using
> YOURMODEL.objects.get(field=query_params.get("search_str"))
>
> the frontend will be responsible for making the requests to search while
> typing
> so, in your views.py you'll do something like this:
>
>
>
> from rest_framework.views import APIView
> from rest_framework.response import Response
>
>
> from .models import YourModel
>
>
> class Search(APIView):
> def get(self, request):
> search_str = request.query_params.get("search_str")
> results = YourModel.objects.get(field_to_search=search_str)
> return Response({"results": results})
>
>
>
> you'll tie it to a route in urls.py file
>
> and you're good to go
>
>
> On Thursday, August 22, 2019 at 10:08:38 AM UTC+2, Soumen Khatua wrote:
>>
>> Hi Folks,
>>
>> I want to give some sequence of suggestion after type of any character(of
>> course if that character match any sequnce of string in database record) in
>> search query parameter, How I can do that by using Django Rest framework.
>> Plase help me guys.
>>
>>
>> Thank You
>>
>> Regards,
>> Soumen
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c6c4f40c-3a2f-4dfc-a310-8e7f17a79827%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6Wb2fJS3Bizx2KNa3FF08ys3FPKbs_nJCfh9UNXNmzc%2BYQ%40mail.gmail.com.


Django db query

2019-08-22 Thread Suraj Thapa FC
class courses(models.Model):
level = (
('beginner', 'Beginner Level'),
('intermediate', 'Intermediate Level'),
('expert', 'Expert Level'),
('all level', 'All Level'),
 )
type = (
 ('live', 'LIVE'),
 ('on demand', 'On Demand'),
 )

ins_id = models.ForeignKey(settings.AUTH_USER_MODEL,
on_delete=models.CASCADE)
coursetype = models.CharField(max_length=50,choices=type, default="on
demand")
cid = models.UUIDField(default=uuid.uuid4, editable=True,
primary_key=True)# course id
course_title = models.CharField(max_length=255, default="")
course_sub_title = models.CharField(max_length=255,default="")
course_level = models.CharField(max_length=255, choices= level,
default="beginner")
course_main_cat = models.ForeignKey(courses_main_categories,
on_delete=models.CASCADE)
course_sub_cat = models.ForeignKey(courses_sub_categories,
on_delete=models.CASCADE)
course_permalink = models.SlugField(max_length=255,default="")
image_path = models.ImageField(upload_to="media",blank=True,default="")
is_published = models.BooleanField(default=False)
is_in_draft = models.BooleanField(default=True)
a_pending = models.BooleanField(default=False)
i_pending = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
live_course_start = models.DateTimeField(auto_now_add=True)
live_course_end = models.DateTimeField(auto_now_add=True)
course_desc = models.CharField(max_length=255, default="")
primarily_taught = models.CharField(max_length=255, default="")




class course_review_report(models.Model):
task_id = models.BigAutoField(primary_key = True)
expert_id = models.ForeignKey(settings.AUTH_USER_MODEL,
on_delete=models.CASCADE)
cid = models.ForeignKey(courses,on_delete = models.CASCADE)
is_completed = models.BooleanField(default=False)
is_pending = models.BooleanField(default=True)
assigned_date = models.DateTimeField(auto_now_add = True)
review_completion_date = models.DateTimeField(auto_now_add = True)


This is my project models
I want to get those cid from courses tables which have the is_published =
True and based on this I want to get the course_review_report data on the
basis of  distinct cid.


Can anyone write the querryset for the same..

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPjsHcHWGKqn82oEz-So%3DKcoT3HKjD5DnHc86d4koBOGxXQnsA%40mail.gmail.com.


Re: Rest framework

2019-08-22 Thread Ahmed Shahwan
you'll just create an endpoint that receives a query parameter with the 
string to search for, and you'll search using 
YOURMODEL.objects.get(field=query_params.get("search_str"))

the frontend will be responsible for making the requests to search while 
typing
so, in your views.py you'll do something like this:



from rest_framework.views import APIView
from rest_framework.response import Response


from .models import YourModel


class Search(APIView):
def get(self, request):
search_str = request.query_params.get("search_str")
results = YourModel.objects.get(field_to_search=search_str)
return Response({"results": results})



you'll tie it to a route in urls.py file

and you're good to go


On Thursday, August 22, 2019 at 10:08:38 AM UTC+2, Soumen Khatua wrote:
>
> Hi Folks,
>
> I want to give some sequence of suggestion after type of any character(of 
> course if that character match any sequnce of string in database record) in 
> search query parameter, How I can do that by using Django Rest framework.
> Plase help me guys.
>
>
> Thank You
>
> Regards,
> Soumen
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c6c4f40c-3a2f-4dfc-a310-8e7f17a79827%40googlegroups.com.


Re: How can I host my application in web hosting?

2019-08-22 Thread Abu Yusuf
Is it a django application? Not every hosting provider provide django
deployments.
You can use amazon aws and digital ocean. You can do also in heroku and
pythonanywhere, they are totally free.

On Thu, Aug 22, 2019 at 5:47 PM Wasim Rana  wrote:

> Hello, I am building a web application locally in my computer. It's almost
> done and I want to host it in Siteground hosting. How can I do that? Please
> help.
> Thanks
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bfc3fc3d-0614-4588-8391-b3a64b1a151a%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACNsr29ws9CDAEECAafFX6yBe6STcoPyGN-6WR1mGDWiENma4g%40mail.gmail.com.


Re: Looking for Django registration API

2019-08-22 Thread Rahul Sharma
Try django-rest-auth 
. This is 
what I have used over the years. Easy to understand and implement. Hope it 
helps you.

On Thursday, August 22, 2019 at 12:15:12 AM UTC+5:30, Sandip Nath wrote:
>
> Are there any ready to use user authentication API for Django where user 
> can register not only with username, password and email but also with date 
> of birth, profile-url, picture etc?
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/61173eab-b55b-4e04-b38d-6b46608ead7d%40googlegroups.com.


Re: Looking for Django registration API

2019-08-22 Thread Rahul Sharma
Try django-rest-auth
.
This is what I have used over the years. Easy to understand and implement.
Hope it helps you.

On Thu, Aug 22, 2019 at 1:06 PM Suraj Thapa FC 
wrote:

> Search djoser
>
> On Thu, 22 Aug, 2019, 12:15 AM Sandip Nath,  wrote:
>
>> Are there any ready to use user authentication API for Django where user
>> can register not only with username, password and email but also with date
>> of birth, profile-url, picture etc?
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/0cef9c81-2a80-48d9-a217-d9418fe94dfb%40googlegroups.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjsHcFykoOCtdQPQiOj8YCpP6uPCJm_vwAsTwzAoEasVnK4wQ%40mail.gmail.com
> 
> .
>


-- 
Rahul Sharma

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMV6LZ6ERFsD4%3DOw%3DvzexxC%2B%2BVR%3Dnf0BA6HnS1Biy7p-UiL-PQ%40mail.gmail.com.


Re: job search

2019-08-22 Thread wd
On Wed, Aug 21, 2019 at 2:32 AM Sam W  wrote:

> I'm sorry.  But knowing Python alone is not enough.
>
>
> I know Python and Django really well, still can't find a job for more than six
> months.
>
>
> You need to know Solid Python programming, python framework (Django (DRF)
> & Flask), Docker and Kubernetes, AWS or Azure, Front-end development
> (React JS), SQL databases (PostgreSQL) and NoSQL database (MongoDB) AND you
> should have some experience with agile development.
>

So, you has these skills still can't find a job fox six months in US? OMG
... wtf..


>
> I’m talking about the job market in United States.
>
>
>
> On Tuesday, August 20, 2019 at 12:26:15 PM UTC-5, Tessnim Zrayga wrote:
>>
>> Hello,
>> I'm looking for a job as a python developer. Any help? I'm willing to
>> relocate anywhere in the world.
>>
>> Regards.
>>
>> --
>> ZRAYGA Tessnim
>> Python Developer
>> solixy.com
>>
>> Skype: tessnim.zr
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e173ecf2-df9b-49eb-a112-fe1d2046e09f%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABexzmgc0Qx8i2%3DyhwVxkqqR7%3DKf_wckq_eNx70cYSqD11ZBsA%40mail.gmail.com.


How can I host my application in web hosting?

2019-08-22 Thread Wasim Rana
Hello, I am building a web application locally in my computer. It's almost 
done and I want to host it in Siteground hosting. How can I do that? Please 
help.
Thanks

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bfc3fc3d-0614-4588-8391-b3a64b1a151a%40googlegroups.com.


Re: Django's str(queryset.query) returns invalid SQL if I compare datetimes

2019-08-22 Thread wd
QuerySet.query is not a plain string, it's an Query object, you can check
the source code

def __str__(self):
> """
> Return the query as a string of SQL with the parameter values
> substituted in (use sql_with_params() to see the unsubstituted string).
>
> Parameter values won't necessarily be quoted correctly, since that is
> done by the database interface at execution time.
> """
> sql, params = self.sql_with_params()
> return sql % params
>
>
It will not quote the params. Here is a way to get the raw sql,
https://code.djangoproject.com/ticket/17741#comment:4 , or if you can
use django-extensions ,set  SHELL_PLUS_PRINT_SQL = True  to print sql
automatically.


On Tue, Aug 20, 2019 at 11:44 PM Jo  wrote:

> I have a Django queryset that I prepare with
>
> queryset.filter(date__gte=datetime(2011,1,1))
>
>
> If I then call `str(queryset.query)` I see this in the string:
>
> ... WHERE "App_table"."date" >= 2011-1-1
>
> However, this is invalid SQL code as if I run this in Postgresql I get
> this error:
>
> ... WHERE "App_table"."date" >= 2011-1-1
> ERROR:  operator does not exist: date >= integer
> HINT:  No operator matches the given name and argument type(s). You
> might need to add explicit type casts.
>
>
> Why is this happening and how can I ask Django to output proper SQL code
> that I can work on?
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3f7a7f2d-2e3d-4167-8b77-2b1c7da5446d%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABexzmiKds1bK5Kdy5bhxwgJbovfvdbCCMtNLJMtPcW7XSGJ_w%40mail.gmail.com.


Re: Installation of django

2019-08-22 Thread Virendra Tripathi
Did you check the versions/ Django2.0 and above supports only Python3.
Virendra Tripathi

Santa Clara, CA

415-910-4955

trip...@gmail.com


On Tue, Aug 20, 2019 at 9:14 PM Amit Samanta 
wrote:

> Hi,
>
> I want to install django in linux server for python 2.7.2.
> i am not able install django
> Please help with the installation step for django in linux.
>
>
> Thanks and Regards
> Amit Samanta
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1972eeeb-da5d-4146-94a6-5ba8551a92ea%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFJ-21Ch5vvDDTz%2BBAgvhSgUaAO3X3_QAHa562tJ1qiF2Mv6MQ%40mail.gmail.com.


Re: Installation of django

2019-08-22 Thread Abu Yusuf
It's just an example to let him know. You can use any version of python3
here.
I did use this because it defaults on ubuntu 16.04 and for me it's a better
combination with python3.5 and django2.0
I did make a lot of applications with these.

That's it. Cheers!

On Thu, Aug 22, 2019 at 4:37 PM o1bigtenor  wrote:

> On Thu, Aug 22, 2019 at 3:35 AM Abu Yusuf 
> wrote:
> >
> > First of all: don't use python2. It will be dead after 4 months.
> > create a virtual environment: virtualenv -p /usr/bin/python3.5 venv
> > then activate it: source venv/bin/activate
>
> Greetings
>
> Curious as to why you wouldn't install python 3.7 at this point?
>
> Regards
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPpdf5-3dtz%2BC_GoQdS3VmDFLZA-X1UvyaGWiG0DyXPueQL-pw%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACNsr285iOJm4dAhDvbCZYcv4Ba1um65-7hV-XWN8WFbT4MRrA%40mail.gmail.com.


Re: Installation of django

2019-08-22 Thread אורי
I recommend Python 3.6 or 3.5. Some things are deprecated with Python 3.7.
For example Django 1.11 runs DeprecationWarnings with Python 3.7.
אורי
u...@speedy.net


On Thu, Aug 22, 2019 at 1:37 PM o1bigtenor  wrote:

> On Thu, Aug 22, 2019 at 3:35 AM Abu Yusuf 
> wrote:
> >
> > First of all: don't use python2. It will be dead after 4 months.
> > create a virtual environment: virtualenv -p /usr/bin/python3.5 venv
> > then activate it: source venv/bin/activate
>
> Greetings
>
> Curious as to why you wouldn't install python 3.7 at this point?
>
> Regards
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPpdf5-3dtz%2BC_GoQdS3VmDFLZA-X1UvyaGWiG0DyXPueQL-pw%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABD5YeF_fMgBDT468y8g8Vvh%3DJ5EntiSWpsBhOE8DAO9sZNy1A%40mail.gmail.com.


Re: Weird Database behavior (Can't access object from a view after directly saving it from inside another view)

2019-08-22 Thread Ahmed Shahwan
I solved the problem.

It's related to the atomic requests. I had "ATOMIC_REQUESTS": True in the 
database settings and XPAY's service responded so fast while the first 
atomic-request hadn't finished yet, so it prevented the other callback-url 
from accessing the same instance.

Thank you very much for your time and effort

On Wednesday, August 21, 2019 at 4:32:03 PM UTC+2, mohammed habib wrote:
>
> What is the Transaction class which your model inherits from ? Is it just 
> a base model ?
>
> Let’s do an experiment 
>
> Print(“object created”) right after the create() method
>
> Print(“callback requested”) on top of your callback method
>
> Which one do you see first ? 
>
> Sent from my iPhone
>
> On 21 Aug 2019, at 16:56, Ahmed Shahwan > 
> wrote:
>
> That's the class, nothing different other than HTTP requests
>
> class CashPayment(BasePayment):
> """Cash Payment Wrapper Class"""
>
> integration_id = CASH_INTEGRATION_ID
>
> def __init__(self, amount_cents: int, billing_data: dict):
> super().__init__(amount_cents, billing_data)
>
> def pay_request(self):
> """Step 4. issue Pay request"""
> payload = {
> "source": {"identifier": "cash", "subtype": "CASH"},
> "payment_token": self.payment_key_res.get("token"),
> }
> self.pay_req_res = self.hit_accept(
> self._api_url + "acceptance/payments/pay", payload=payload
> )
>
>
> On Wednesday, August 21, 2019 at 3:39:13 PM UTC+2, mohamed habib wrote:
>>
>> if you are able to share more code from the `utils.CashPayment` call that 
>> may help us
>>
>> On Wed, Aug 21, 2019 at 4:37 PM mohamed habib  wrote:
>>
>>> I highly doubt its related to ORM or postgres, the creation of the 
>>> record is synchronous so you can be sure that the record exists after the 
>>> create() call.
>>>
>>> Since you are sure that you are fetching the data properly we can rule 
>>> out this possibility
>>>
>>> Its probably a race condition of the callback arriving too soon *before* 
>>> you hit the create() call. So do you know at what point your payment 
>>> gateway will make the callback request and what would trigger it? Make sure 
>>> you are 
>>>
>>> On Wed, Aug 21, 2019 at 4:19 PM Ahmed Shahwan  wrote:
>>>
 I tried, same happened. it's related to how Postgres works internally 
 with the Django-ORM.

 On Wednesday, August 21, 2019 at 3:07:47 PM UTC+2, mohamed habib wrote:
>
> Wild guess in the dark here, as I am unfamiliar with this API. you are 
> doing:
>
>  `payment.pay_request()` 
>
> before creating the WeacceptTransaction object. 
>
> Maybe this line needs to move below: 
> `models.WeAcceptTransaction.objects.create(...)` ? 
>
> At what point is the callback request triggered ?
>
> On Wed, Aug 21, 2019 at 3:36 PM Ahmed Shahwan  wrote:
>
>> Transaction model:
>>
>>
>> class WeacceptTransaction(Transaction):
>>"""Weaccept's Transaction model"""
>>
>> # before frontend interaction
>>auth_token = models.TextField()  # got from step 1
>>order_id = models.IntegerField(verbose_name="Accept's Order ID")  # 
>> id from step 2
>>order_url = models.CharField(max_length=255, null=True)  # 
>> order_url from step 2
>>billing_data = JSONField()  # provided in request for paymet key, 
>> step 3
>>payment_key = models.TextField()  # payment_token from step 3
>>hmac = models.TextField(null=True)
>># after (from callback)
>>success_status = models.BooleanField(default=False)
>>is_refunded = models.BooleanField(default=False)
>>reference_number = models.IntegerField(null=True)
>>processed_clbk_json = JSONField(null=True)
>>
>>
>> The cash_payment View:
>>
>> class CashPayment(APIView):
>>"""Cash Payment endpoint"""
>>
>> serializer_class = serializers.CardPaymentSerializer
>>required_fields = ["amount_cents", "billing_data"]
>>
>> def post(self, request):
>># Validate required fields
>>utils.validate(self.required_fields, request)
>>payment = utils.CashPayment(**request.data)
>>payment.prepare()
>>payment.pay_request()
>># create a new transaction
>>models.WeacceptTransaction.objects.create(
>>merchant_order_id=payment.merchant_order_id,
>>amount=payment.amount_cents,
>>auth_token=payment.auth_res.get("token"),
>>order_id=payment.order_reg_res.get("id"),
>>order_url=payment.order_reg_res.get("order_url"),
>>billing_data=payment.billing_data,
>>payment_key=payment.payment_key_res.get("token"),
>>hmac=payment.pay_req_res.get("hmac"),
>>)
>>
>> return Response(
>>{
>>"message": "Our representative will go to the address 
>> you provided "
>>  

Re: Installation of django

2019-08-22 Thread o1bigtenor
On Thu, Aug 22, 2019 at 3:35 AM Abu Yusuf  wrote:
>
> First of all: don't use python2. It will be dead after 4 months.
> create a virtual environment: virtualenv -p /usr/bin/python3.5 venv
> then activate it: source venv/bin/activate

Greetings

Curious as to why you wouldn't install python 3.7 at this point?

Regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPpdf5-3dtz%2BC_GoQdS3VmDFLZA-X1UvyaGWiG0DyXPueQL-pw%40mail.gmail.com.


Increase Count Value

2019-08-22 Thread Soumen Khatua
Hi Folks,
I want to increase count value of a record after ftech the record each time
in django rest framework.
*This is my model.py*




*class Dataset(models.Model):name = models.CharField(max_length = 100)
  number = models.IntegerField()hits = models.IntegerField(default = 0)*


*api/views.py*










*class DatasetListAPIView(ListAPIView):serializer_class =
DatasetlSerializerdef get_queryset(self):qs =
Dataset.objects.all()word = self.request.query_params.get('word')
  if word is not None:qs  = qs.filter(name__icontains =
word).order_by(Length('name').asc(),'-hits')return qs
  search_fields = ('name',)*

Please help me guys.

Thank You in advance

Regards,
Soumen

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WamWbSOYTACSuzbo3MQORbBEadByphzUT3m7YrO8b2Rjg%40mail.gmail.com.


Re: Is there any ready to use Django script for user management like the UserCake or User Spice framework in PHP?

2019-08-22 Thread Derek
You may want to work through a tutorial on user registration.

Once you see the general approach, you'll be better able to see where you 
need to add your custom business logic (e.g. "check for an existing user").

https://pythonprogramming.net/user-registration-django-tutorial/


On Tuesday, 20 August 2019 22:39:34 UTC+2, Vishal Parkar wrote:
>
> New to Django. Wish to port a web application to Django, which I have 
> already developed in PHP & MySQL with the UserSpice framework providing the 
> user management. I have modified the registration functionality such that 
> only the ones invited using their emails by some already existing users can 
> only register. I wish to get the user management functionality readymade 
> and wish to be able to modify it as needed. 
> Thanks in advance!

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d7144657-d227-4a9e-92be-0427c3ee0960%40googlegroups.com.


Re: Django's str(queryset.query) returns invalid SQL if I compare datetimes

2019-08-22 Thread Cornelis Poppema
What makes sense to me is the query builder (ORM) in Django 
"escapes"/quotes the values at the very last moment: whenever the query is 
to be executed in a database. Different databases can have different escape 
characters. When you print queryset.query it simply isn't at a stage where 
the escape characters have been added. No "default" quoting is happening 
because Django has no implementation for this: all escaping is off-loaded 
to the specific database packages if possible (e.g. MySQLdb, psycopg2, 
sqlite3). Simply put: queryset.query isn't meant to output valid sql as-is, 
nobody claims as much. In fact, checking the source code actually 
underlines my point:

https://github.com/django/django/blob/8a281aa7fe76a9da2284f943964a9413697cff1f/django/db/models/sql/query.py#L253-L262

def __str__(self):
"""
Return the query as a string of SQL with the parameter values
substituted in (use sql_with_params() to see the unsubstituted string).
Parameter values won't necessarily be quoted correctly, since that is
done by the database interface at execution time.
"""
sql, params = self.sql_with_params()
return sql % params


On Tuesday, 20 August 2019 17:43:38 UTC+2, Jo wrote:
>
> I have a Django queryset that I prepare with 
>
> queryset.filter(date__gte=datetime(2011,1,1))
>
>
> If I then call `str(queryset.query)` I see this in the string:
>
> ... WHERE "App_table"."date" >= 2011-1-1
>
> However, this is invalid SQL code as if I run this in Postgresql I get 
> this error:
>
> ... WHERE "App_table"."date" >= 2011-1-1
> ERROR:  operator does not exist: date >= integer
> HINT:  No operator matches the given name and argument type(s). You 
> might need to add explicit type casts.
>
>
> Why is this happening and how can I ask Django to output proper SQL code 
> that I can work on?
> 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0ed2b0cf-f1e1-4bd7-8504-2c99e778c27a%40googlegroups.com.


Django scrapy Multiple Image Saving

2019-08-22 Thread 'Shreejith Unnikrishnan Nair' via Django users
Hi
I am trying to integrate scrapy with django for the purpose of scraping
blogs.
The image in numbers varies across each blog.How i could save it
dynamically in database and display exacty in same way as source site
through django view.

Please let me know if you have any suggestions

-- 
Thanks & Regards,
Shreejith

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADGnmLx0QW04HwU7ZxQ0OAqy1%3D4kmw7hOVb4bK3Jj8o9DjC2EQ%40mail.gmail.com.


Re: Installation of django

2019-08-22 Thread Abu Yusuf
First of all: don't use python2. It will be dead after 4 months.
create a virtual environment: virtualenv -p /usr/bin/python3.5 venv
then activate it: source venv/bin/activate
Then run pip install django.
That's it.

On Wed, Aug 21, 2019 at 2:38 AM herve bineli  wrote:

> Please, provide the errors you get when trying:
>
> $ pip install --user django
>
> on your shell
>
> On Tue, Aug 20, 2019 at 4:44 PM Amit Samanta 
> wrote:
>
>> Hi,
>>
>> I want to install django in linux server for python 2.7.2.
>> i am not able install django
>> Please help with the installation step for django in linux.
>>
>>
>> Thanks and Regards
>> Amit Samanta
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/1972eeeb-da5d-4146-94a6-5ba8551a92ea%40googlegroups.com
>> 
>> .
>>
>
>
> --
> *BINELI MANGA Hervé Arsène*
> Ingénieur Informaticien - ENSPY 2017
> binelima...@gmail.com
> (+237) 691388922 / 678711903
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJm63Ok1XR55WVzVG78OjBTrOybVrgykmBX-JzP3MGE6j_wpMA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACNsr2_ekLW31AV9F7G4zRDpWgV%3DVkFDcqJRot98GGQXuXUqhg%40mail.gmail.com.


Re: Django Template url mapping

2019-08-22 Thread Abu Yusuf
Your template name should be: template_name = "index.html"
That's all.

On Thu, Aug 22, 2019 at 12:55 PM RONAK JAIN  wrote:

> Hi
>
> I am new in Django I am doing struggle with add  Django templates using by
> inheritance.
>
>
> so when I am trying within *Example::  index.html  add inside the
> blog.html but, *I am getting the direct blog.html, not index.html on the
> index page.
>
>
> so I used simply in index.html.
>
> *index.html:*
>
> {%. include  "blog.html"   %}
>
> *view.py*
>
> class blog(TemplateView):
> template_name = "blog.html"
>
>
> *or Can I use templateview for dynamically ?*
>
>
>
> can you help me with that? how can I render dynamically my blog.html file?.
>
>
> Thanks
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BAqMUdZDk3ce7HY5WTTB0uVNA%3DYsnx3OxUj3x4rf3%3D-2AfMBA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACNsr29ACtT4JDf3He8h_14HXRLQQxP%2BLJD5oz7XBusuSnx0nw%40mail.gmail.com.


Rest framework

2019-08-22 Thread Soumen Khatua
Hi Folks,

I want to give some sequence of suggestion after type of any character(of
course if that character match any sequnce of string in database record) in
search query parameter, How I can do that by using Django Rest framework.
Plase help me guys.


Thank You

Regards,
Soumen

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6Wa5-7S17uyLfoiAJQ0A5hJ6iv0_mospz5cGGYV--nsfxA%40mail.gmail.com.


Re: Looking for Django registration API

2019-08-22 Thread Suraj Thapa FC
Search djoser

On Thu, 22 Aug, 2019, 12:15 AM Sandip Nath,  wrote:

> Are there any ready to use user authentication API for Django where user
> can register not only with username, password and email but also with date
> of birth, profile-url, picture etc?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0cef9c81-2a80-48d9-a217-d9418fe94dfb%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPjsHcFykoOCtdQPQiOj8YCpP6uPCJm_vwAsTwzAoEasVnK4wQ%40mail.gmail.com.


Django Template url mapping

2019-08-22 Thread RONAK JAIN
Hi

I am new in Django I am doing struggle with add  Django templates using by
inheritance.


so when I am trying within *Example::  index.html  add inside the blog.html
but, *I am getting the direct blog.html, not index.html on the index page.


so I used simply in index.html.

*index.html:*

{%. include  "blog.html"   %}

*view.py*

class blog(TemplateView):
template_name = "blog.html"


*or Can I use templateview for dynamically ?*



can you help me with that? how can I render dynamically my blog.html file?.


Thanks

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BAqMUdZDk3ce7HY5WTTB0uVNA%3DYsnx3OxUj3x4rf3%3D-2AfMBA%40mail.gmail.com.