Ivan
Hello, guys. Is it exist hack to use mixins in django migration? Can’t find any related info in google
Doragonsureiyā
Ivan
http://xyproblem.info/
Ok, I got you.
So, I have model A that have been inherieted from mixin ImageUrlMixin
Mixin: https://dpaste.org/jFYac
In data migration i can’t use filed and properties from my mixin
Is it exist hack to use mixins in django data migration?
Doragonsureiyā
Star
Hello
Where are Education djanfo reset framwork?
Doragonsureiyā
talha
How can I add my domain name to the django framework (in a personal computer that runs 7/24 like a server with no external service) which method is better, and why?
Star
.
TypeError: init() got an unexpected keyword argument 'choises'
.
dont work makemigrations
Vaibhav
Vaibhav
.
wtf
.
hahahahah im sorry i didnot see
Vaibhav
.
Marc
Hi guys,
I have a strange problem with my view code.
- the print statement is not getting exectuted
- model is not saved to DB
can´t figure out what is wrong
Using django 4.1
Code is as follows:
#views.py
def add_post(request):
form = PostForm(request.POST or None)
if request.method == 'POST':
print(f"request.method: {request.method }")
if form.is_valid():
post = form.save(commit=False)
post.content = form.cleaned_data['content'],
post.status = 'P',
post.publish_date_time = timezone.now()
post.save()
return redirect('index')
return render(request, 'posts.html', {'form': form})
#forms.py
class PostForm(forms.ModelForm):
content = forms.CharField(
required=True, min_length=15, widget=forms.Textarea)
class Meta:
model = Post
fields = ['content']
Marc
commata at end are typo, original code is without
Ali
Hello, how to look at the url input parameter like below👇
Test.com/all/?book_id=3
I want to get this book_id as a parameter, how can I do this?
Faouzi Ben ✍️
Marc
First check your form view and check it is set to post
you mean the form itself? it is
<form action="." method="post">
{% csrf_token %}
{{ form | crispy }}
<input type="submit" value="Submit" class="btn btn-primary">
</form>
Naziru
object has no attribute size
For img in images:
If img.size < 200000:
IMG.show()
else:
return False
Please how am to solve this error
Ali
Sergey
Hi everyone! Is there a way to use copy of existing database (but without data) in tests?
Giri
I want to learn django and along with rest from scratch
Giri
Any suggestions guys
The Inspired
Start with official django tutorial
Anonymous
Greetings everyone, I have a question , how do I redirect to a dynamic url.?
Akhmadjon Akbarov
Sergey
Mirco
Anonymous
Can you show me your views?
The one I want to redirect to is
def dynamic(request, pk):
//Code inside here rendering the html template
When I access the url manually it works
path('dynamic/<str:pk>', views.dynamic, name = 'dynamic')
Pasha
Hello everyone, please tell me where I can read about the interaction and connection of instant messengers and Django REST?
Pasha
I made a website in django and with the REST I want to connect a telegram bot to get information in it
but I can't figure out how to do it
Sayidbek
Baba
Pls I need a help, I just uploaded my website on namecheap but the media files are not displaying
Baba
They only display when I turn debug to True
Baba
Pls what can I do?
Azeez
Baba
I use namecheap as my hosting,how can that help me?
𝙑𝙞𝙯 𝙋𝙖𝙡𝙖𝙨
Baba
Maxim
Maxim
X_ShaygaN_D
Hi,
How can I use django.contrib.auth.forms.PasswordChangeForm to create a change password form and add it to a generic view?
I get the error that the __init__ function is missing 1 required positional argument: 'user'
Anonymous
Sinceritate
Hi, how can i get request data from ViewSet? (Django REST API)
Sinceritate
And how can I understand where user changed the data with a put request
Arshiya
Sinceritate
Arshiya
sumit
sumit
Hello everyone
I am Sumit.
I am beginner in python and Django. Plz help me in coding
Sinceritate
Who can help me with models? in DM because i can't upload photos here
Charly
Sinceritate
https://codeshare.io/4e9dl3
How can i set admin_inactive True, if inactive = True
Vaibhav
Sinceritate
post_date = models.DateTimeField(auto_now_add=True) why not working?
Gumi
Hello do I need to cover all topics to get a basic level django developer job ?
Assylzhan
Beaty
Hello,,,I try to run my django server but it's not running,,any help
Charly
Pasha
Pasha
if i understand the question correctly
Alexey
Pls what can I do?
you need to configure the output of static files in nginx https://djangodeployment.readthedocs.io/en/latest/05-static-files.html
𝙑𝙞𝙯 𝙋𝙖𝙡𝙖𝙨
عبد الله
Hey. have you faced this error in flake8 linter last day?
AttributeError: 'EntryPoints' object has no attribute 'get'
عبد الله
X_ShaygaN_D
Hi, I'm trying to use django.contrib.auth.forms.PasswordChangeForm for a generic UpdateView, But I'm having trouble
The form inherits from django.contrib.auth.forms.SetPasswordForm which in it's __init__ function it requires a user.
The error I get is: SetPasswordForm.init() missing 1 required positional argument: 'user'
I have no idea how to give it the user, It works fine with django.contrib.auth.views.PasswordChangeView but the problem is that it's a global view, Meaning that it's a static URL for everyone, But my URL is mapped like this:
path('u/<slug:slug>/account/password/', UserPasswordChangeView.as_view(), name='password'),
The form inherits from Forms.Form at the very bottom, I believe Forms.ModelForm might be what I want here, Is this form even usable in my case?
If yes how can I do this
forms.py:
class UserPasswordChangeForm(PasswordChangeForm):
class Meta:
model = User
fields = ('old_password', 'new_password1', 'new_password2')
views.py:
class UserPasswordChangeView(UpdateView):
model = User
form_class = UserPasswordChangeForm
template_name = 'auth/password.html'
context_object_name = 'authuser'
link to stackoverflow if you need more details
I'm ASUR
How to use session in forms.py for validation
Baba