Wednesday, September 25, 2019

Re: Digest for django-users@googlegroups.com - 25 updates in 10 topics

Is there a way to create a thumbnail of video file?

On Wed, 25 Sep 2019, 08:38 , <django-users@googlegroups.com> wrote:
TruZillah <ubeyo.software@gmail.com>: Sep 24 07:57PM -0700

try using aws... go to aws.com and sign-up for a free account and used the
Amazon Personalize service... or your can google it and it will take you
right there
 
On Monday, September 23, 2019 at 11:48:12 PM UTC-4, Gabriel Araya Garcia
wrote:
TruZillah <ubeyo.software@gmail.com>: Sep 24 08:03PM -0700

aws offers a good solution google Amazon Personalize... that will help you
solve your problem...
 
On Monday, September 23, 2019 at 11:36:32 PM UTC-4, Mahir Shah wrote:
Perceval Maturure <drperceval@gmail.com>: Sep 24 09:09PM +0200

Hi awesome django users
i want to list model records of App1 in a detail view of App2
any ideas?
Regards
 
--
*Perceval Maturure*
 
*083 303 9423*
Jani Tiainen <redetin@gmail.com>: Sep 24 11:06PM +0300

Hi.
 
Just import models and use them?
 
ti 24. syysk. 2019 klo 22.10 Perceval Maturure <drperceval@gmail.com>
kirjoitti:
 
Paul Barber <ubeyo.software@gmail.com>: Sep 24 07:45PM -0700

I was actually thinking of doing the same thing
 
On Tuesday, September 24, 2019 at 3:10:46 PM UTC-4, Perceval Maturure wrote:
TruZillah <ubeyo.software@gmail.com>: Sep 24 07:59PM -0700

i am trying to reply to people question but for some reason it won't go
through so i am going to see if this post actually goes through
yasar arafath Kajamydeen <yasarnow@gmail.com>: Sep 24 08:13PM -0700

Dear All,
 
Actually i forget my virtual environment name. So when i run -- python
manage.py runserver command its showing error like this .
 
 
ImportError: Couldn't import Django. Are you sure it's installed and
available on your PYTHONPATH environment variable? Did you forget to
activate a virtual environment?
 
 
 
 
Thanks in Advance.
 
 
Regards,
Yasar Arafath K
Sahil Sharma <sahilsharma2471@gmail.com>: Sep 24 10:42AM -0700

I was running a populate script to fill data in my database but facing some
error
 
sharing the screenshot
 
user is a class create in the models.py which contain three fields
class user(models.Model):
firstname=models.CharField(max_length=250,unique=False)
lastname=models.CharField(max_length=250,unique=False)
emailid=models.CharField(max_length=500,unique=True)
def __str__(self):
return self.emailid
 
 
[image: 2019-09-24-1569346732_screenshot_1920x1080.jpg]
RONAK JAIN <jainronak877@gmail.com>: Sep 24 11:30PM +0530

Hi Sahil,
 
 
please go to settings.py.
 
 
*put this in top of settings.py this will configure Django for you*
 
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", __file__)import django
django.setup()
 
Thanks & Regards
 
RJ
 
 
On Tue, Sep 24, 2019 at 11:23 PM Sahil Sharma <sahilsharma2471@gmail.com>
wrote:
 
Desh Deepak <deshdeepakxpm@gmail.com>: Sep 25 07:54AM +0530

Which databases are you using?
 
leb dev <testdevleb@gmail.com>: Sep 24 12:16PM -0700

I now how to use django pagination with ORM django after filtering the
required data and put in into *pagination div*
 
*queryset_list = employee.objects.all()*
*query=request.GET.get("q")*
* if query:*
* queryset_list=queryset_list.filter(*
* Q(name__icontains=query)|*
* Q(father_name__icontains=query)|*
* Q(mother_name__icontains=query)|*
* Q(content__icontains=query)|*
* Q(create_date__icontains=query)*
* # Q(user__first_name__contains=query)*
* ).distinct()*
 
 
* paginator = Paginator(queryset_list, 5)*
* page_request_var = "page"*
* page = request.GET.get(page_request_var)*
* queryset = paginator.get_page(page)*
 
* context={*
* "object_list":queryset,*
* "title":"List Items",*
* "page_request_var":page_request_var,*
* }*
* return render(request,"blog/list.html", context)*
 
 
the above code is working
 
my question is how to convert this ORM into raw SQL
 
i know that i must use LIMIT and OFFSET in raw SQL to embedded into
paginator.
Deep Sukhwani <deepsukhwani@gmail.com>: Sep 25 06:37AM +0530

Have you tried using the *.query* on Django's QuerySet (documentation: [1])
 
For example, if my QuerySet is:
*User.objects.filter(username__contains='alpha')*
 
I can obtain the underlying raw SQL Query using:
*print(User.objects.filter(username__contains='alpha').query)*
*>>> *print(User.objects.filter(username__contains='alpha').query)
SELECT `auth_user`.`id`, `auth_user`.`password`, `auth_user`.`last_login`,
`auth_user`.`is_superuser`, `auth_user`.`username`,
`auth_user`.`first_name`, `auth_user`.`last_name`, `auth_user`.`email`,
`auth_user`.`is_staff`, `auth_user`.`is_active`, `auth_user`.`date_joined`
FROM `auth_user` WHERE `auth_user`.`username` LIKE BINARY %alpha%
 
1:
https://docs.djangoproject.com/en/2.2/topics/db/sql/#performing-raw-queries
 
--
Regards
Deep L Sukhwani
 
 
Larry Martell <larry.martell@gmail.com>: Sep 24 08:22AM -0400

Anaconda, Enthought, ActiveState, Red Hat and maybe others as well.
Also large companies can do their own support.
 
Deep Sukhwani <deepsukhwani@gmail.com>: Sep 24 05:59PM +0530

Thanks for the prompt reply. Did a quick cursory check with Anaconda, I
don't think Anaconda does it. In fact Anaconda has posted a few months ago
about Python 2's EOL (End of Life) -
https://www.anaconda.com/end-of-life-eol-for-python-2-7-is-coming-are-you-ready/
 
Also, just did a quick look at their professional services, couldn't see
anything suggesting they will offer python 2 support beyond the python 2's
community itself.
 
--
Regards
Deep L Sukhwani
 
 
Larry Martell <larry.martell@gmail.com>: Sep 24 08:31AM -0400

You can get anyone to do anything for enough money.
 
Nick Sarbicki <nick.a.sarbicki@gmail.com>: Sep 24 01:33PM +0100

I'm not convinced anyone could pay me enough to go back to Python 1...
 
 
On Tue, Sep 24, 2019 at 1:32 PM Larry Martell <larry.martell@gmail.com>
wrote:
 
Larry Martell <larry.martell@gmail.com>: Sep 24 08:40AM -0400

Ha! How about perl? ;-)
 
"Andréas Kühne" <andreas.kuhne@hypercode.se>: Sep 24 03:23PM +0200

Yes of course - I think RedHat will be continuing to support a python 2
environment because they haven't updated their own internal infrastructure
and also their distributions to python 3.
 
However - using one of those is still not very smart. The problem is that
all plugins have moved on. So Django, Flask, Numpy, Scipy, Mypy, Pypy and
so on are ported to python 3. The main argument still stands - why invest
money today into a language that is obsolete - and that you have had
several years notice to stop using? Porting to python 3 isn't that hard
either - there are a lot of tools to help you do that. I myself have ported
a website from python 2 to python 3, with tens of thousands rows of code.
 
So all you need to do is to set aside time to port the applications - and
if you don't do it now, you WILL need to do it later - that's a simple
fact. And then the code will be in the best case scenario obsolete, worst
case useless. I can't see one reason to invest a cent into writing python 2
code. I know that I am lucky to be able to define what I want to work with
and to set requirements and also have no legacy code. But even having
legacy code, it's just a matter of investing into your own application.
 
To say that it can't be done - look at Instagram - they did it with their
codebase, and I don't think that many of us are working on that size of
codebase.....
 
Regards,
 
Andréas
 
 
אורי <uri@speedy.net>: Sep 24 04:45PM +0300

On Sat, Sep 21, 2019 at 8:32 PM Ankita Gupta <ankita.gupta1998@gmail.com>
wrote:
 
> Not related to Django...
 
Then write to python-list@python.org
Mike Dewhirst <miked@dewhirst.com.au>: Sep 25 08:59AM +1000

I think the original question was around backwards conversion of 3.x
code to 2.7.
 
I don't know of course because all my efforts have been forwards but I
believe the six module would be the easiest way backwards.
 
And I imagine you would simply run your unit tests in 2.7 and use the
six utilities to correct errors. With a little luck that would
simultaneously keep the codebase compatible with 3.x for the inevitable
forward upgrade.
 
Just a thought
 
Mike
 
On 24/09/2019 10:00 pm, Larry Martell wrote:
Avi gehlot <15ecocs009@gmail.com>: Sep 24 09:44AM +0530

Yo put in admin.py
Django.models import users
 
But
You put apptwo.models inport users
This way ...
 
On Tue, 24 Sep 2019 at 9:43 AM, Deep Sukhwani <deepsukhwani@gmail.com>
wrote:
 
MEGA NATHAN <cloudnathan1997@gmail.com>: Sep 24 10:13PM +0530

Hi.
again i change and run but same problem coming ....
 
 
 
*Regards*
Meganathan G
 
 
 
On Tue, Sep 24, 2019 at 10:32 AM Abu Yusuf <yusuf@binate-solutions.com>
wrote:
 
"Huy Bùi" <huybui150396@gmail.com>: Sep 24 12:41AM -0700

Hello,
 
Everytime i try to access a url, the Django developer server auto quit
without any log about what happens.
After debugging a little bit, i find out if i remove this block of code in
the template file, i can access the web page normally:
 
<select name="department1" class="department">
<option value=""></option>
{% for d in departments %}
<option value="{{ d.id }}"> {{ d.name }} - {{ d.department_code }}
</option>
{% endfor %}
</select>
 
But i can iterate the QuerySet in the view normally, it seems like there
aren't any problem iterating the QuerySet:
 
def edit(request):
departments = Department.objects.filter()
for d in departments:
print(d.id, d.name, d.department_code)
 
return render(request, 'edit/edit.html', {'departments': departments})
 
I have no idea what is happening and it's driving me crazy. Any help would
be appreciated. Thank you.
Deep Sukhwani <deepsukhwani@gmail.com>: Sep 24 09:29PM +0530

Possible to push the whole code to a Github repo so someone could check out
and try locally - Couldn't really figure out anything that might be going
wrong by looking at this much mode?
 
Also, just out of curiosity, why are you using *Department.objects.filter()*
instead of *Department.objects.all()* since you are anyways not passing
anything to the filter.
 
--
Regards
Deep L Sukhwani
 
 
Christian Franke <nobody@nowhere.ws>: Sep 24 04:39PM +0200

Hello,
 
I am a bit confused about the relation and separation of
responsibilities between `AuthenticationForm.confirm_login_allowed` and
`ModelBackend.user_can_authenticate`.
 
When `AuthenticationForm` is used together with `ModelBackend`, we will
never call `AuthenticationForm.confirm_login_allowed` for an inactive
account, because `ModelBackend.authenticate` will never return an
inactive user, as `ModelBackend.user_can_authenticate` will return
`False` for inactive users. So the error message "This account is
inactive." is never shown for this combination of Form and Backend, and
the error message will always be about an incorrect password.
 
When `AuthenticationForm` is combined with `AllowAllUsersModelBackend`,
`AuthenticationForm.confirm_login_allowed` will be called and raise a
validation error for inactive accounts, because they are returned from
the backend, leading to the error message "This account is inactive."
 
Given that `AuthenticationForm.confirm_login_allowed` exists the way
that it does, it seems like there are valid configurations in which the
form has the responsibility to determine the user's authorization to log in.
 
However, it seems quite dangerous to me to leave it up to the form to
deny login to users, e.g. because there might be other ways of
authentication that are not using AuthenticationForm.
 
So my question would be: Under which circumstances is it a good idea to
leave such authorization decisions up to the form/what setup did the
original authors have in mind when writing `confirm_login_allowed`?
 
All Best,
Chris
 
--
I like PGP. How about:
curl -slf https://nowhere.ws/nowhere.asc | gpg --import -
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to django-users+unsubscribe@googlegroups.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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BzKLUZ1R-WPCu1kTMsvQrLkcbOMrgtoN6BkoSnYC5MogwX_6w%40mail.gmail.com.

No comments:

Post a Comment