Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 14 16:11
    @MadLittleMods banned @Rehmanjeff
Buğra
@BgR8
@hannylicious
Buğra
@BgR8
is it true anyone else know
vadisinasaisudha
@SaiSudhaV
Hello I am new to open source can anyone help me how to contribute
Harpreet Singh
@Harpreet1999
hey there how's everyone. I'm here to say hi. to the community. Currently working on the polls tutorial, i've gone through the basics and hopefullly i'll complete it in few days. i'm looking forward working with you guys.
Bo
@BoPeng
I am trying to return the "latest version" if there are multiple versions of the same book from a list. It is like Book.objects.values('title').annotate(Max('version'))but I would like to get the original Book objects, not the versions. How can I do that?
Nam Le
@leqnam
@BoPeng have you tried this? https://stackoverflow.com/a/30777133
Bo
@BoPeng
I cannot see how it is related to my question at a first glance. My books have different versions but they are separated and have different permissions, in the sense that a visitor can see the latest published version and an editor can see the latest under-review version, so there is no universal latest for all visitors. Right now I am doing something like Book.objects.filter(... according to visitor) then get the latest allowed versions in Python, and I am wondering if there is a SQL / DRM solution here.
I could compute a bunch of flags such as latest_under_review, latest_published but keeping track of these flags with the addition and removal of books can be a hassle.
On the SQL side https://stackoverflow.com/questions/6841605/get-top-1-row-of-each-group suggests the use of cross apply, which does not seem to be supported by django DRM.
Dr. Muhammad Anjum
@anjumuaf123_twitter
@anjumuaf123_twitter
hi any body Please, how can i update 3.6 to 3.8 python version on window 10
?
Hanny Goodwin
@hannylicious
Download Python3.8, Install it on Windows10 same as you did 3.6 and use both (should you want) or just uninstall 3.6 if 3.8 works for you. You can have multiple versions of Python installed (in my experience it has worked without issue).
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious Thanks sir, but I want to use only 3.8 , just to update 3.6 to 3.8 , I have already installed 3.6
Hanny Goodwin
@hannylicious

I think you can just download 3.8 and install it, and then uninstall 3.6.

I don't think there is an 'upgrade in place' type option.

Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious Sir, thanks , but in the you tube I saw one video , they have option but not for me
@hannylicious sir, in this video it shows .....https://www.youtube.com/watch?v=UXSxBx8eG28
Hanny Goodwin
@hannylicious
In that video - he goes and downloads the latest version of python from the website and runs the installer. So my original advice is correct: go and download Python3.8 and run the installer - then if you want to delete Python3.6, uninstall it.
Dr. Muhammad Anjum
@anjumuaf123_twitter
image.png
@hannylicious sir, please look he has option to upgrade
@hannylicious but me donot have this option why?
Hanny Goodwin
@hannylicious
Because you're installing a different version. That option would probably show up if you were upgrading from 3.6.x to 3.6.x. My understanding is that a 3.8 installation is a completely different, unique install which is separate from a 3.6 installation - so there is not an upgrade option because there is no 3.8 already installed.
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious right sir
@hannylicious let me try
image.png
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious sir, you are right , I have 3.6.7 , when i did dowload 3.6.8 , then there was an option to upgrade
Hanny Goodwin
@hannylicious
Excellent, glad we've got it sorted. :) Now you can keep 3.6 installed if you wish and use 3.8, too!
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious sir, I have already Pycharm installed , but from where I can uninstall 3.6.7 to get new latest version 3.8
Hanny Goodwin
@hannylicious
For uninstalling a program on Windows, google will have the answer pretty easily (control panel -> uninstall -> Python3.6)
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious right sir thanks
@hannylicious let me try
Dr. Muhammad Anjum
@anjumuaf123_twitter
image.png
@hannylicious sir, if you see at the bottom at right side there is still 3.6 , but I did installed 3.8, why not it appears here ?
Hanny Goodwin
@hannylicious
I don't use Pycharm, but you can setup Pycharm to use a different version of Python probably pretty easily I imagine. You have to tell Pycharm which version of python to use in preferences/settings I imagine.
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious let me try sir
James Komo
@jameskomo
Anyone who has worked with Django all Auth here especially on REDIRECT_AFTER_EMAIL_CONFIRMATION? I am having challenges as my redirect does not work unless I am logged in
AlbertDavid
@AlbertDavid94
well, it does say auth, which has something to do with a user
QbasicFan
@QbasicFan
@BoPeng So retrieve the latest stable version, one flag should be enough... isPublish ?(y/n)
then combining that flag with the date... It should easy to show who see what latest version
Bo
@BoPeng
@QbasicFan This is essentially what I am doing now but moving forward there will be more "editors", "groups" with different roles and authors might "share" different versions of the books with different people. So in theory everyone could see different subsets of versions of the same book and have different "latest" version. I could use multiple flags and reduce the chance that people in the same group see different versions of the book, but it is more straightforward to have a general query that says Book.objects.filter(can be seen by user).filter('keep only the latest').
QbasicFan
@QbasicFan
@BoPeng I see why you are referencing multiple flags... and why the 'can be seen by user' can be problematic... Looks like a good architectural design will help you reduce the number of flags needed
@BoPeng How do you manage appending different versions... ? Do you overwrite the save() to handle it?
Bo
@BoPeng
They are completely different entries with the same author and title but different version. Every new version is forked from the old one because the book is not text objects and cannot really diff.
I know what you meant by good architectural design but in the same time I would like to keep "permission" and "logistics" orthogonal so that the query will always return the correct latest versions no matter how the logistics change.
Bo
@BoPeng

I am thinking of doing something like

def get_queryset(self):
    books = Book.objects.filter(by self.kwargs['user'])
    return [x for x in books if is_latest_version(x, books)]

but returning a list for a function that expects a QuerySet can be problematic.

QbasicFan
@QbasicFan

what if you have a 'permission' integer that works like that :

  • perimssion : 0 => super user admin
  • perimssion : 1 => admin
  • perimssion : 2 => editor level 1
  • ...
  • perimssion : n => logged visitor
  • perimssion : n+1 => anyone
  • then

check against the correct date ?

also author (one to many) titles
title (one to many) versions...
Bo
@BoPeng
No, because reducing from multiple versions is the next level of filtering after permission. That is to say, editor level 1 can have multiple versions of the same book with permission 1.
QbasicFan
@QbasicFan
@BoPeng that is an interesting project version control + complex permission system.
Bo
@BoPeng

I guess in the worst case I can do

def get_queryset(self):
    books = Book.objects.filter(by self.kwargs['user'])
    latest = [x.id for x in books if is_latest_version(x, books)]
    return Book.objects.filter(id__in=latest)

if I have to return a QuerySet instead of a list.

QbasicFan
@QbasicFan
I am confused I thought will do something like
book = Book.objects .filter(by self.kwargs['user']) .filter(permission) .filter(lastest_version)