okay sure, your template yields: /people/ -> calls your people view -> your view calls the server with a base count of 5 -> you deserialize the json into a dict and send it to the template -> the template renders the returned `results` -> the next/prev links are set depending on the next/prev values /people/?page=1 < > /people/?page=3 -> when you fire these links you send the request to your view again and s
Arvidj joined the channel
o on
BeerLover
the link i've changed for obvious concerns
av_ joined the channel
but xterm the links in next and prev are different than what my app's links are
the server providing the data is external
xterm
BeerLover: that's where the manual labor comes into play
geezhawk joined the channel
shangxiao joined the channel
BeerLover: you can crop out the query string and just send it as is back to the server!
BeerLover: how about this, build whatever you can until you get stuck on a specific issue and then ask again with the code pasted. We won;t leave you stranded promise.
geezhawk
anyone here use django-friendship? I'm having some trouble with it
xterm
i can be your friend ^.^
flototo
anyone here know how to open a link in a browser as response of a view ?
richb8 has quit
xterm
flototo: that's not how it works and it wouldnt work. the link itself that's invoking the url should mention the target
SteenJobs has quit
maryokhin joined the channel
huleo joined the channel
huleo
hi
I'm wondering what would be the simplest / best way to add css class to invalid inputs (validation errors) inside some form
jtiai
I think in form thereis option to set CSS for invalid inputs...
flototo
xterm: Thank for your reply. I am using djoser's work for the user part of my api. To confirm the email during the registration, we send a confirmation email with a link. From this link i am calling a view and in reponse to this i would like to open a webpage just to say in a nice way "your email address has been confirmed"
guys, here: http://dpaste.com/1XCQ2C7 instead of taking the single field from cleaned_data, there's and helper that let to store the data in the database directly from POST data if the form is_valid()?
uczekalla has quit
jonky joined the channel
jonky
hi
uczekalla joined the channel
urbanendeavour joined the channel
moldy
realnot: sorry -- what? please rephrase.
realnot: i think you are looking for ModelForm
realnot
moldy: yes
now i'm taking all form field from cleaned_data
prohobo
realnot create a ModelForm instance with initial data pointing to the cleaned_data
validate the ModelForm then save
realnot
but before to run form.save() is should add another field that is not provided buy the user in the form
prohobo
then add it
realnot
so, for example:
partner = Partner.objects.get(slug=slug) form = self.form_class(request.POST, instance=partner, prefix='contact')
in this way, the partner object will be added in the missing field of the form?
moldy
realnot: yes, so what, no problem
either override the modelform's save() method to save both objects, or save the related object from your view
realnot
moldy: this is the model: http://dpaste.com/3KAT0GQ and this is the form: http://dpaste.com/0FYT5WS the field partner should be added before validate and the save the form right? I don't know how to do this
sagaragarwal94 joined the channel
codeme has quit
jessamynsmith joined the channel
moldy
realnot: eh, just use a plain ModelForm
BeerLover has quit
realnot: ModelForms know how to deal with related objects, no need to write custom code for this
huleo
jtiai: dealt with that with overriding is_valid function, to add widget class as needed
it can be set in form directly, but is taken into account only when rendering whole form in the template
({{ form }})
not separate inputs
anyway, problem solved :)
realnot
moldy: ok, but don't know how to set a field that is not provided. the partner field is retrieved in this way: partner = Partner.objects.get(slug=slug) so, before to validate and save the form, how i can add this extra field?
Lisa1157_ has quit
codeme joined the channel
moldy
realnot: exclude the partner field from the form, save the form with commit=False, then save it with the partner object
Hello! I have a model class that is subclass of AbstractUser and I have written a form using it as the model but the password field shows plain text (not asterisks). How could I fix this? I also need to make sure the password is stored hashed.