These are chat archives for django/django

25th
Sep 2017
:]
@elcolie
Sep 25 2017 04:02
Hi
I am selecting the tools
My requirement is
  1. System has manager roles
  2. System has staff roles
  3. manager can not authenticated to mobile devices
My solution right now is DRF JWT with customization a bit. Then mobile devices will knows that this account's role is manager or staff
New approach is OAuth. I heard the name, but never try it before. Will be fit for my needs? Or overkill the question?
Luke-VideoLibre
@LukeVideo
Sep 25 2017 07:42
Could someone help me adapt this snippet to a django view style.
Luke-VideoLibre
@LukeVideo
Sep 25 2017 07:54
with open('/path/to/encrypted_data.bin', 'rb') as fobj:
    private_key = RSA.import_key(
        open('/path_to_private_key/my_rsa_key.pem').read(),
        passphrase=code)

    enc_session_key, nonce, tag, ciphertext = [ fobj.read(x) 
                                                for x in (private_key.size_in_bytes(), 
                                                16, 16, -1) ]
i ned to adapt this to use variables instead of opened files.
I have a message.message object with the cypherText
And i also have a userinfo.encryptedKey object that stores the encrypted key
Luke-VideoLibre
@LukeVideo
Sep 25 2017 08:02
I guess i could use the file library to write to a file that i don't save... But that used as a variable could do the for x in .... stuff....
:]
@elcolie
Sep 25 2017 12:16
Hi
User.objects.create_superuser('codobot', 's@codium.co', None)
With this line I has codobot as an superuser. That is correct, but in the password field it also has value !gpgU15VoAl0D2kKaPYdLWJgl0s2c8vhRkG5v90Ap
Does codobot has a authorized password?
Luke-VideoLibre
@LukeVideo
Sep 25 2017 12:36
It's saved as a salted hash. So even if he doesn't have a password their is a field in the database. as i understand.
daltorya19
@daltorya19
Sep 25 2017 12:36
can someone help me with python please?
:]
@elcolie
Sep 25 2017 12:41
@LukeVideo Thank you I got the answer from StackOverflow now
@daltorya19 If it is not too hard. I might be able to help
Shubham Arora
@shubhamarora
Sep 25 2017 12:41
Hey! I am making a middleware and i need to know these response going back belong to which request. How can i do that? Please let me know if questions requires some more clarity.
I am logging a request and response both. I need to give a same unique no to both the request and response log, so that i can get the relation b/w them.
daltorya19
@daltorya19
Sep 25 2017 12:42
its very easy
@elcolie print('you just tried to bet','$'+int(bet),'but you only have $'+str(money))
TypeError: must be str, not int
:]
@elcolie
Sep 25 2017 12:43
I will answer you in python3 Since you are on Django and Django is dropping python2 soon
f"you just tried to bet {bet}, but you only have {money}"
You'd better ask in python room
daltorya19
@daltorya19
Sep 25 2017 12:44
nobodys online
do you know how to do it?
:]
@elcolie
Sep 25 2017 12:45
@daltorya19 You are mixing the syntax. That's your problem
daltorya19
@daltorya19
Sep 25 2017 12:45
can you fix it please?
:]
@elcolie
Sep 25 2017 12:45
I answered it already. f"you just tried to bet {bet}, but you only have {money}"
daltorya19
@daltorya19
Sep 25 2017 12:46
what is the f" for?
:]
@elcolie
Sep 25 2017 12:51
https://www.python.org/dev/peps/pep-0498/
It is string interpolation
LordXyTh
@LordXyTh
Sep 25 2017 23:55

Hey everyone, quick question. Can I define a custom form inside html, and then save that into my models? or do absolutely have to use a ModelForm?

In which case, can I customize the form within the HTML if a use a modelForm?