Ivan
Hello, guys. Is it exist hack to use mixins in django migration? Can’t find any related info in google
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ā
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?
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like: - https://dpaste.org - https://linkode.org - https://hastebin.com - https://bin.kv2.dev If you posted a wall of text, go back and delete it.
Star
Hello Where are Education djanfo reset framwork?
Doragonsureiyā
Hello Where are Education djanfo reset framwork?
What is this word salad supposed to mean?
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
.
Shouldn't that be choices and not choises?
CHOISES=( ('in stock', 'В наличии'), ('out of stock', 'Нет в наличии'), ) status = models.CharField(choises=CHOISES, max_length=15)
.
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?
Marc
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?
When a URL is like domain/search/?q=haha, you would use request.GET.get('q', ''). q is the parameter you want, and '' is the default value if q isn't found. https://stackoverflow.com/questions/150505/capturing-url-parameters-in-request-get https://fedingo.com/how-to-capture-url-parameters-in-django-request/
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
Sergey
Hi everyone! Is there a way to use copy of existing database (but without data) in tests?
cj
Hi everyone! Is there a way to use copy of existing database (but without data) in tests?
just the structure of tables? django will take care of that automatically when running tests, just be sure you have your migration files updated
Giri
I want to learn django and along with rest from scratch
Giri
Any suggestions guys
The Inspired
Start with official django tutorial
Doragonsureiyā
I want to learn django and along with rest from scratch
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Anonymous
Greetings everyone, I have a question , how do I redirect to a dynamic url.?
Mirco
yep, just i want to skip migrtaions that already on one of my stage. To speedup my tests
if u use pytest and pytest-django u can specify —no-migrations and —reuse-db
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
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?
Maxim
Pls what can I do?
google django debug media
Baba
google django debug media
I've tried to fix them using Google answers,but I've not gotten a solution to it
Azeez
Maxim
I've tried to fix them using Google answers,but I've not gotten a solution to it
Django is not a webserver it can work as a webserver, but this feature was added only to simplify development (when DEBUG is enabled) use a full-fledged webserver for static files more details in the documentation, not in communities
Baba
I use namecheap as my hosting,how can that help me?
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'
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
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
Who can help me with models? in DM because i can't upload photos here
No, help is provided here, read the rulkes on how to share code
Sinceritate
https://codeshare.io/4e9dl3 How can i set admin_inactive True, if inactive = True
Sinceritate
post_date = models.DateTimeField(auto_now_add=True) why not working?
Peter
post_date = models.DateTimeField(auto_now_add=True) why not working?
post_date = models.DateTimeField(auto_now=True) This is the correct way to achieve what you want.
Gumi
Hello do I need to cover all topics to get a basic level django developer job ?
Beaty
Hello,,,I try to run my django server but it's not running,,any help
Charly
Hello do I need to cover all topics to get a basic level django developer job ?
Not even experienced developers know all the topics, so at least follow the official tutorial and try to make some projects
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
you need to configure the output of static files in nginx https://djangodeployment.readthedocs.io/en/latest/05-static-files.html
I already did that the static files are displaying,but the media files are not @Telega12345