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
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)
Adham Farrag
@adhamfarrag
Why I’m getting this error
Building wheel for Pillow (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/username/Documents/Practice/Other/project-website/project-env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-_jgvipfu/Pillow/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-_jgvipfu/Pillow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/tmp/pip-wheel-uyjkgaxw
       cwd: /private/tmp/pip-install-_jgvipfu/Pillow/
  Complete output (144 lines):
command used sudo python3 -m pip install -r requirements/local.txt
Bo
@BoPeng
To avoid storing multiple copies of the same file (from multiple objects the files belong or multiple users), I would like to separate filename and file content in handling user-uploaded files. That is to say, the model will use two char fields filename, filecontent (hash value) to refer to a file, where the content is saved separately according hash values in a shared location. In this way renaming files, uploading files with the same content will not result in new file content. I feel that this could be a very common approach for repository-like applications. Does anyone know an existing app or example that work in this way?
Bo
@BoPeng
Ohmm, I see django-hashedfilenamestorage but not sure if it is compatible with my AWS storage model.
matrixbot
@matrixbot

Brett Jackson > <@gitter_bopeng:matrix.org> How to I prevent users from registering user names such as user, users, about, and login? I have URL /{user_name} mapped for users so these usernames could conflict with system URLs (/about will not work even if a user successfully registers about as a user name). I even want to disallow names such as fxxk. I could list all names in clean_username but I am wondering if there is an existing approach.

Bo, could you mitigate that by placing your other routes above the /{user_name} route?

Bo
@BoPeng
@matrixbot I would like to make the URLs as short as possible for users so that they can type easily. Although I can move /users from all_auth to /~users, having a user named /users will still be confusing. I came across https://github.com/dsignr/disallowed-usernames/ and added the list to UserCreationForm.clean_username.
Another way is to dispatch non-/{user_names} to admin.mycompany.com using django-hosts but it might be an overkill and does not really solve the problem of mycompany.com/users even if the real users URL is admin.mycompnay.com/users.
Nam Le
@leqnam

To avoid storing multiple copies of the same file (from multiple objects the files belong or multiple users), I would like to separate filename and file content in handling user-uploaded files. That is to say, the model will use two char fields filename, filecontent (hash value) to refer to a file, where the content is saved separately according hash values in a shared location. In this way renaming files, uploading files with the same content will not result in new file content. I feel that this could be a very common approach for repository-like applications. Does anyone know an existing app or example that work in this way?

Hmm. Why don't you create a new Model called BookVersion that will store histories of books (One-to-Many)? Then, fillter them with the Book Id

Bo
@BoPeng
@leqnam Are you referring to the hash file content question or the old versioning problem? My app has a pretty complex version structure in that users can share multiple versions of Book to selected invitees and groups so that everyone sees a different set of versions. For example, a "work in progress" versions could be shared with group members, and "published" versions could be shared to all visitors. What you suggested seems to like a Model for Book and a one to many relationship to multiple versions of the Book, but I still cannot figure out how to get the most "viewable" version for each user using these two models.
Nam Le
@leqnam
Hmm, so I think you add more field, named book_status in the Books table. then just query with status you want, Once the book is published, change the status