Morteza
down
@
Павел
Hello! I have a form, here is example: https://pastebin.com/zhFjCdaK
I'm trying to make the created_date_range field set to one of the values by default, but no matter how I specify it, I can't. The default is always the first element from my DATE_RANGE_CHOICES tuple
Of the options on how to specify initial, I tried everything on this page:
https://stackoverflow.com/questions/657607/setting-the-selected-value-on-a-django-forms-choicefield
Maybe there are some other options?
i have tried the following:
- specified initial = "today" directly in the created_date_range attribute
- specified self.fields["created_date_range"].initial = "today" in the initialization method
- specified self.initial = {"created_date_range": "today"} in the initialization method
- specified self.initial["created_date_range"] = "today" in the initialization method
Suren
Ogunbo
Please how to I run my development server through https
Charly
Ogunbo
Charly
Trying to link social authentication
And? Which one is requiring https?
But also your questios has no relation with Django, check on google maybe you can use letsencrypt or similar
Ogunbo
Angel
Guys, I have a consult, anybody here can tell me how remove user from a specific group using a function :/
Angel
I'm only know how to do that in terminal
Charly
Angel
like this :
user = User.objects.get(username='name ')
group = Group.objects.get(name='name group')
user.groups.remove(group)
Влад
Hi all,i' from Ukraine,i'm junior front end.Just say me,will i spend a lot of time to learn django or not?I know js a good for junior
Charly
Charly
Angel
It becasuse i don´t now how to pass a spesifitc user
Angel
hehe
Of course
Hi, how we can translate automatically our site languages to another?
Angel
I'm new in using this frmawork
Charly
Of course
Of course
Of course
Hell
hello guys, there is a function that takes all the lines that are described in the form.py and checks if there have been changes in them, after which it displays the old and new value. but the problem is that I don't need to take all the lines, because if I send only 3 lines and there are 15 of them in the form, then I get a keyerror.
please tell me how to correctly transfer exactly those lines that the user edited, that is, which he sent (post)
the call in this line happens:
diff = diff_with_form(form, Contract.objects.get(pk=contract_id))
check function: diff_with_form
code - https://linkode.org/#wUJbdJWa9XVIqvkYtkCUh5
Charly
Hell
or maybe tell me how can I add an exception so that it skips none (ignores)
new = dict(form.fields[field_key].choices)[form.cleaned_data[field_key]]
for this line
Charly
Bhokali Topa
Thate a frontend job 🙃
Ivan
Ivan
I've already done it but it doesn't work.
widgets = {'title': forms.TextInput(attrs={'class': 'form-control form-input form__input'}),
'content': CKEditorUploadingWidget(attrs={'class': 'form-control form-input form__input add-article-form__textarea'),
'cover_image': forms.FileInput(attrs={'class': 'form-control form-input form__file-btn'})}
ShuvamTheBeast
Suren
Did u read the tutorial?
Yes, but didn’t understand maybe what I am reading is wrong( if bot difficult please give a link what to read exactly
ShuvamTheBeast
ShuvamTheBeast
Lightbourne
hello everyone. how can i configure standalone parameters in django admin? like having additional settings as in admin's email (to send feedback to). so those parameters could be configured on admin page instead of going through the project's configuration files
S
S
u appear to have one to many relationship between Picture & Tours model
S
S
Check the urls, what entities are passed.
Sinan
How do I give permission to only specific users to edit model fields in Django rest?
Anonymous
Hello everyone, I have trouble with uploading big files (more 4gb), so when i upload big file my request is lagging. So how i can check file size before the request?
Anonymous
This is my code
models: https://dpaste.org/En0WS , https://dpaste.org/uuUhO#L10,11,16 ;
view: https://dpaste.org/xJXV0 ;
upload_func: https://dpaste.org/04fw9#L
Suren
Sasha
https://www.django-rest-framework.org/tutorial/quickstart/
Hi! here he creates app: django-admin startapp quickstart and this app appears inside "tutorial" folder. How to achieve the same?Thanks
Charly
Charly
Charly
the root is tutorial
Kh
Hi all, has anyone tried to write pandas data frame to db from django, except the to_sql method?
X_ShaygaN_D
Hi Guys, I have a 'Post' model and I have an update page for it, I want to limit the page for logged in users only and if they weren't logged in, I want to redirect them to the Post's detail page instead.
X_ShaygaN_D
urls.py:
urlpatterns = [
path('', PostListView.as_view(), name='index'),
path('<int:pk>/', PostDetailView.as_view(), name='details'),
path('new/', PostCreateView.as_view(), name='new_post'),
path('<int:pk>/edit', PostUpdateView.as_view(), name='update_post'),
]
X_ShaygaN_D
views.py
class PostUpdateView(LoginRequiredMixin, UpdateView):
login_url = reverse('details', args=[self.pk]) #TODO
model = Post
form_class = PostUpdateForm
template_name = "posts/update_post.html"
X_ShaygaN_D
I am unable to get the pk to refer the user to it
X_ShaygaN_D
For example if the user tries to access '.../5/edit' without being logged in, i want them to be redirected to '.../5'
Rajat
Anyone know how to use django channel with celery
Doragonsureiyā
Anyone know how to use django channel with celery
Don't ask meta questions like:
"Any user of $x here?"
"Anyone used technology $y?"
"Hello, I need help on $z!"
Just ask directly! The better you are at explaining the problem, the more likely you are to get help.
Asking smart questions
S
Right now I dobt hav the bandwidth for that.
عَبٔدُ الٔحَكِيم
django.db.utils.IntegrityError: NOT NULL constraint failed: attendance_attendance.account_id
عَبٔدُ الٔحَكِيم
i have a n error like this what i should do
عَبٔدُ الٔحَكِيم
i've searched stackpwerflow there were written you should delete your migration and migrate again but it didnt work
Serhii
Hello.
How I can create search bar in my django project. I have created forms and send request to my class view.
Firstly I gotten 405 error, when I add post method to view I can not return response with queryset to my template.
Serhii
def post(self, request, **kwargs):
return HttpResponse(self.get_queryset().filter(status=1))
Serhii
I did but I see only text on white page
Serhii
S
Serhii
S
You seem to have miss some relationship to add to ur models.
Also cross- check if u hv any circular or intra relationship within a model itself.
Ali
Is there any way to access the serializer field inside the method field?
Jay
null value in column "created_by_id" of relation "products_products" violates not-null constraint
Jay
i have used foreign key in this field