Luis
Hi guys! I'm using ModelForm and need to add extra field (password) to the form. How can I do it ?
Luis
I think DJango 1.11 breaks when you use fields = ('_ _all_ _') and try to add extra fields
R
Just don’t use all, and define explicitly all the fields you want in your form
R
R
👍👍
Luis
Prosto
Hello evbdy! Need help with django-flatpages. I have footer.html template and there is lot of links like
<a href="/about/" target="blank">{% trans "About company" %}</a>
Its ok with transltation of 'About company', when im switching language. But how to switch link to other language?
Prosto
i was trying to solve it by django-modeltranslation. fork flatpages to my apps, make translation.py. and command update_translation_fields is showing that everything is ok - Updating data of model '<class 'apps.myapps.flatpages.models.FlatPage'>' . But there is no second language fields.
Prosto
Any solutions pls!
R
R
Otherways, you can look at how they do it in this package which seems to be using the same approach as you are trying https://github.com/PragmaticMates/django-flatpages-i18n
George
hi, how would you make a subdir structure?
I think i should replace or escape spaces. How should i deal with this?
In my app i replaced spaces with underscore.
inchidi
dhelbegor
Hi guys, can someone help me with a doubt please?
I'm trying to use tox and pytest in my django project but the tox don't find my python path, i'm using virtualenvwrapper and unfortunately pyenv is not a option
dhelbegor
this is the error
dhelbegor
ERROR: py36: commands failed
George
inchidi
Yes
why you think you need to remove spaces? url work with spaces tho
George
Anders (izzno / gooood) 🇳🇴
django-rest-api:
I have a serializer of a model that has a field named accessories which is a foreign key to objects of the same model. To display the "ID" of the accessory I have to create another serializer basically doing the same thing (repeating code) because you can not refer to the class you are in. Is there a better way?
https://pastebin.com/8dYe1iwf
dhelbegor
Anders (izzno / gooood) 🇳🇴
dhelbegor
😁
Rajjix
This should be deleted ? with a nice ban for this guy advertising stupid stuff in an educational group
Jimmies San
@bharhshhabih76 not spam or will be banned.
George
Hi, where should i post a blog about django?
Rajjix
i like quora
George
hummm, but posting a coding blog about django in quora i don't think it would be appropiate
Jimmies San
George
mmmmm, maybe but i don't feel that confident haha
Jimmies San
George
medium is not expected to have really profesional editing right?
Rajjix
or just google any django question and find on which site people mostly post such stuff, and get most views, these are the kind of sites u’ll find ur viewers on
Jimmies San
George
i will try in medium, also i would like to have a kind index like: "These are all my posts"
Rajjix
Start your own blog with django 😃 takes you a couple of days to build with 10$ domain name ssl included
George
i don't want to spend money xD
Jimmies San
George
Jimmies San
and you have statistics about visit/views
George
i'll do medium
Jimmies San
something like that
Jimmies San
it's really cool
George
yay
Jimmies San
:)
George
i am going to put the interesting "difficult" things that i coded
Jimmies San
Rajjix
Can’t wait 🤓
Jimmies San
i like a lot code snippets inside the post, or a git repos with all source stuff [just an idea :)]
George
Jimmies San
George
sareh 👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾
George
Also, how do you comply in Django with 80 characters pep rule? It's kind of impossible
George
Oh, i just found out https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/
An exception to PEP 8 is our rules on line lengths. Don’t limit lines of code to 79 characters if it means the code looks significantly uglier or is harder to read.
George
I added flake8 extension in emacs so it's always red
Anders (izzno / gooood) 🇳🇴
This is so anoying:
https://pastebin.com/e8iX4Xn3
I've tried with supers, lambdas so on and so forth, but for this case i CAN not not repeat code... frustrating.
Anders (izzno / gooood) 🇳🇴
I know I should just move on, its working...
Mirco
Have u tried to inherit AccessorySerializer inside ProductItem ?
So you inherit all attributes from it and then specify it by adding accessory field
If I don't go wrong
Anders (izzno / gooood) 🇳🇴
I could but that would not be very readable as it would be the wrong inheritance (or wrong way). And i would have to repeat the fields as they are slightly different.
Rajjix
make one field list at the top
Rajjix
Class meta = field list
Rajjix
second
Rajjix
Class meta =field list + access
Rajjix
Roughly
Anders (izzno / gooood) 🇳🇴
Can you add to tuples ?
Rajjix
Yes
Rajjix
only tuples
Anders (izzno / gooood) 🇳🇴
I did not know that.
Anders (izzno / gooood) 🇳🇴
:D
Rajjix
1, 2, 3 + (1, )
Anders (izzno / gooood) 🇳🇴
hah
Anders (izzno / gooood) 🇳🇴
Then inheritance is the way to go ;)
Rajjix
i guess
Anders (izzno / gooood) 🇳🇴
will just be fields += ('accessories')