#
Nop, is a validation of the form
i think u should use validate_autor rather than clean_autor
Nicolas
with the same code?
#
nope it differ
#
man try User.objects.get(username=autor) if it is work
Nicolas
nope it differ
How can i do it?
#
How can i do it?
change filter to get
Nicolas
it's perfect
Nicolas
I do it in this way
Nicolas
def clean_autor(self): autor = self.cleaned_data["autor"] autor_exist = User.objects.filter(username=autor).exists() if not autor_exist: raise forms.ValidationError('Sorry, the autor does not exist') else: autor = User.objects.get(username=autor) return autor
#
Thankss!
there could be bug, u make complex ur code
Anonymous
Hello, I am developing a system to learn python(django), but I am stuck in an error, which unfortunately is simple when I google search, no result was similar to my case ... In my system, first registration is from Clients, later Hosts. I created the CRUD Client that worked as expected, but when creating the CRUD Host, I added a Select element that lists the Clients, to add a Host, the template passed the Select data via Post normally. But on the Update template, it simply does not pass Select value via post to the view ... <select type="id_client" name="id_client"> <option value="{{ h.id_client }}" selected>{{ h.id_client.name }}</option> {% for c in clients %} <option value="{{ c.id_client }}">{{ c.name }}</option> {% endfor %} </select> For a Select that does not change in an update view, is it necessary to do something different?
Anonymous
Debugging, I found that in the view the field is receive the value: "---------"
Anonymous
For web development, I'm very newbie, this is my form in the template:
Anonymous
<form class="col s12" action="{% url 'coreRelback:hostUpdate' h.id_host %}" method="POST"> {% csrf_token %} <div class="row"> <div class="input-field col s6"> <select type="id_client" name="id_client"> <option value="{{ h.id_client }}" selected="selected">{{ h.id_client.name }}</option> {% for c in clients %} <option value="{{ c.id_client }}">{{ c.name }}</option> {% endfor %} </select> <label>Client name</label> </div> </div> <div class="modal-footer"> <button class="btn waves-effect waves-light green" type="submit"> Update <i class="material-icons left">system_update_alt</i> </button> <a class="modal-close btn waves-effect waves-light"> Back <i class="material-icons left">exit_to_app</i> </a> </div> </form>
Maks
Hello. Please tell me how in django rest to output in json only those objects whose field satisfies a certain condition, for example, not zero?
Anonymous
what about the html part,did u handle what u have to handle in it?
https://github.com/supernoi/relback/tree/relback_django If it's easier to read the code ...
Maks
ur query determine it
I need to hide objects whose value of a certain field is zero
#
I need to hide objects whose value of a certain field is zero
use exclude query man for further check django docs
Maks
use exclude query man for further check django docs
Thanks for the suggested direction👍
sohrab
I with using cpanel project great not working because in support create project all right
cj
I with using cpanel project great not working because in support create project all right
what? can you use proper English? trying to understand what you said, let me tell you that cPanel doesn't support Django
sohrab
I'm sorry I had written wrong.
sohrab
About English
sohrab
But I supports CPanel and Django
Anonymous
Algorithmic Questions: 30 min for each question (1 hour in total). 1.Produce a list of numbers with length k and numbers in range dis Given a list of integers and a number x, find the smallest sub-list with sum greater than the given value. Examples: my_list = [1, 4, 45, 6, 0, 19] x = 51 Output: 3 Minimum length sub-list is [4, 45, 6] my_list = [1, 10, 5, 2, 7] x = 9 Output: 1 Minimum length sub-list is [10] my_list = [1, 11, 100, 1, 0, 200, 3, 2, 1, 250] x = 280 Output: 4 Minimum length sub-list is [100, 1, 0, 200] my_list = [1, 2, 4] x = 8 Output : Not Possible Whole list sum is smaller than 8. 2.You are given a matrix of MxN boolean values representing a board of free (True) or occupied (False) fields. Find the size of the largest square of free fields. Examples: board = [ [True, False], [False, False] ] Output: 1 board = [ [True, False, True, True], [False, True, True, False] , [False, True, True, Flase]] Output: 2 board = [ [True, False, True, True], [False, True, True, False] , [False, True, True, Flase], [False, True, True, Flase]] Output: 2
maroong
But I supports CPanel and Django
Some hosting sites support Django on their cpanel. I've seen Django in softaculous
ℕo ℕame
I use postgres in chat app for storing messages. I work with web sockets (channels). Is it not expensive to make query to db and save message every time when a user send message?
Eric
I use postgres in chat app for storing messages. I work with web sockets (channels). Is it not expensive to make query to db and save message every time when a user send message?
Postgres is pretty performant. Will your chat app ever need to exceed thousands of INSERTs per second? Do you have that many active concurrent users?
Ihor 🐈
Does Django's cache middleware separate cache for the same urls but with different query-parameters?
Anonymous
like and dislike button.any module or sample?
Anonymous
How do I submit a form who's content is dynamic (as in fetched from database)? 🤔
Shubham
How to upload multiple files in one go in DJANGO?
Shubham
Without Ajax
xarala221
Without Ajax
- You can get all files in a list - Do a loop to get each file - In each file submit the form
Hussein
How do I make the code delete images when they are replaced?
Shubham
So how to select multiple files when the pop up window comes to select file?
Shubham
That's not allowing to select multiple images
xarala221
Shubham
Okay Thanks
Shubham
How can I get the latest inserted I'd?
Shubham
Id*
Shubham
Or the of ID of the data which xyz user uploaded the last? Keeping in mind other users are also filling data in the same table
PV
Does anyone know an accounting app built on django, available open source
Shubham
Is last() available in Django 3?
PV
.first() and .last() are available from django 2
Anonymous
How do I submit a form who's content is dynamic (as in fetched from database)? 🤔
Why does no one answers my queries? Am I not following the rules? 🙄
Mirco
Why does no one answers my queries? Am I not following the rules? 🙄
Maybe you just need to wait someone has free time to answer u
Михаил
How do I submit a form who's content is dynamic (as in fetched from database)? 🤔
https://docs.djangoproject.com/en/3.0/topics/forms/modelforms/#modelform-factory-function
Shubham
Thanks everyone🍎
cj
Is last() available in Django 3?
why wouldn't it be available? 🤔
Anonymous
I can't go to the previous page on clicking the browser's back button 😕
Anonymous
Why so?
Anonymous
It just gets me a blank tab 🙄
Martín
I get this error: TemplateSyntaxError at /es/home/ 'blocktrans' doesn't allow other block tags (seen "url 'django_sftpbrowser:sftp-index'") inside it with this code <p id="welcome_msg">{% blocktrans %} You are authenticated now. You may go on and explore the sheet music and resources by clicking <a id="redirLink" href="{% url 'django_sftpbrowser:sftp-index' %}">this link</a>. {% endblocktrans %}</p>
Martín
Oh, I think I found it
Anonymous
I can't go to the previous page on clicking the browser's back button 😕
Was using location.replace instead of location.href ... Stupid me 🤦🏻‍♂️
Andrew
what is the difference between gettext, ugettext, gettext_lazy, ugettext_lazy?
Doragonsureiyā
what is the difference between gettext, ugettext, gettext_lazy, ugettext_lazy?
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box write down the same words you asked here Step 4: Read the firsts results
John
is it possible in heroku server to create a folder using os.mdkir? or any os command?. .
Rupesh
How to get id though url in Django. Send Id blog page to single blog page with anchor tag. How to get id in single blog page
Tony
Is it possible to host a django project on cpanel
Mirco
Is it possible to host a django project on cpanel
Don't think so Choose another ( better ) way , there are so many 😊
Swapnil
I want send mail in django it shows in sendmail function
Swapnil
Anyone is there ??
🤔
all dead
Felix
I want send mail in django it shows in sendmail function
Maybe next week i will have the same Problem 😂
Swapnil
Swapnil
Error
Swapnil
Sendmail function error