User
Which topic?
actually its a code and i am facing issue while generating graph can you help
Isa
How to mock NamedTemporaryFile def test_ads_txt_processor_success(*args): mock_file = NamedTemporaryFile() mock_file.name = 'path-to-file/test.gz' with( patch('tempfile.NamedTemporaryFile', return_value=mock_file), .... with NamedTemporaryFile(mode='wb') as temp_file: ... with NamedTemporaryFile(mode='wb') as temp_file - returns temp file, but not my fixture file
Danish
Try with NamedTemporaryFile(mode='w+b') as tempfile:
Isa
I need get my fixture not real temp file
@l!®€z@
django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'auth.User' that has not been installed Does anyone know where the problem is
Vikash
Can you please explain your question a bit more, unable to understand it
Yes I want implemented same functionality same as like export when I click export action in django a file format form will be open same as when I click on my custom action a queryset will be open
Aкмаль
hi guys, i have one little question, what type of data queryset is? is it dict or just a list?
Arman
How to implement service in Django which has to take user's uploaded file then check it in order to detect does it contain malware and if does not then to save in db, otherwise reject? Additionally I did some research and turns out there are 3 common solutions, pls reply me with the number with which u had experience and would suggest me, 1. django-clamd, 2. DMF(django-middlware-fileuploadvalidation), 3. do api request to virustotal
ƑѦⴽⵊⵠƲƝ
Yo buddies... Can anyone recommend me a Full Django Backend course
ƑѦⴽⵊⵠƲƝ
?
Rose
Yo buddies... Can anyone recommend me a Full Django Backend course
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial (https://docs.djangoproject.com/en/dev/intro/tutorial01/) * Tutorial from MDN (https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django) * Tutorial from django-girls (https://tutorial.djangogirls.org/en/)
Myworld@vz
Hello guys anybody have an idea about AR view with djago rest framework?
Rose
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like: - https://dpaste.org - https://hastebin.com - https://nekobin.com - https://bin.kv2.dev If you posted a wall of text, go back and delete it.
Rose
Hello guys anybody have an idea about AR view with djago rest framework?
To get an answer to your question, it is worth to formulate it more clearly, perhaps add more details, perhaps add explanations.
Rose
User J has 1/3 warnings; be careful! Reason: crossposting
ali
Does anyone know why django still uses template system which is not used anymore, Nowadays, backend developers use apis and microservices?????!!!
Charly
Husen
ImportError: Module 'authentication_user.apps' does not contain a 'AuthenticationUserConfig' class. Choices are: 'AuthConfig'. #help
Mr. Achiever
Hello Team, I'm planning to create a web application similar to YouTube using Django. Can someone guide on how to start? I've already created multiple web apps using Django for day to day tasks. But this time planning for streaming videos using Django. Please suggest.
ali
Because not everyone uses APIs and microservices (django is not a framework for microservices)
But modern web technology nowadays is the microservices, and Django still uses a template system, which is obviously not the most used and easy case.
Charly
But modern web technology nowadays is the microservices, and Django still uses a template system, which is obviously not the most used and easy case.
No, microservices are not just modern web technology, most apps don't even require them and it's a pattern that adds tons of complexity. And still most small apps use templates. May not be your case but not the general case
ali
No, microservices are not just modern web technology, most apps don't even require them and it's a pattern that adds tons of complexity. And still most small apps use templates. May not be your case but not the general case
Instead, add better flexibility in each service. However, django brings some limitations. Like admin customization and etc., with all I think it can get better. That's my personal opinion.
Tejas
hi, I have two apps in Django: account and tasks. account handles authentication (login, logout, register) with URL paths like /home, /register, /login, and /logout. When a user is not logged in, I want the /home page not to render content, and only allow access to the dashboard or /home after login/registration. How can I achieve this?
The_Invisible_Drax
hi, I have two apps in Django: account and tasks. account handles authentication (login, logout, register) with URL paths like /home, /register, /login, and /logout. When a user is not logged in, I want the /home page not to render content, and only allow access to the dashboard or /home after login/registration. How can I achieve this?
I can't under understand what you are saying but. If you dont want to render specific content then in your template you can use if else with request.user.is_authenticated. but if you want to hide the entire page then use decorator @login_required
The_Invisible_Drax
@login_required in your views
Tejas
@login_required in your views
i have two app 1st one manage authentication stuffs and other one is a handle task mangement i want to connect those two apps each other e.g. when user is not logged in then he not see content on the home page. i want to know how should i connect apps
Tejas
in one project i have two apps i want to connect with each other!!!
ford
You have to be friend with official django documentation, most of the quiz you ask here, have answer in the docs.
Tejas
You have to be friend with official django documentation, most of the quiz you ask here, have answer in the docs.
yo @henriod i am best friend with documentation but documentation mad at me so i ask my query here which is django related group where we can ask stuffs related django that we are not familiar
ford
have gone through this part the https://docs.djangoproject.com/en/5.0/topics/auth/default/#limiting-access-to-logged-in-users
ford
You can even create your own decorator for login_required based on your auth app setups
Tejas
Tejas
Thank you 🙋‍♂️
Abhijit
Hello friends I want state and district drop-down features in django When user selects state it automatically generated the district How to configure it pls help me..
Abhijit
I want to introduce these fields in my forms.py section
Abhijit
U have some link or example
Asaf
Hello guys! Am working with Supabase, Anyone know how to do a ForeignKey in auth.users at Soupabase?
begzod
Hi guys, need some help: subquery = Account.objects.filter(goal_meeting=OuterRef('pk'))[:5].values('id') return GoalMeeting.objects.prefetch_related( Prefetch( 'accounts', queryset=Account.objects.filter(id__in=subquery), ), Prefetch( 'accounts__images', queryset=Image.objects.filter(is_main=True) ) ).all() Here you need to get only 5 Account instances from the model. How do I do this in the request? This code does not work as it should, output only one instance
begzod
it doesn 't work ( are there any other ways ?
Rose
User Alireza has 1/3 warnings; be careful! Reason: crossposting
Nati
You can download Django documentation pdf from documentation website, idk what you mean by cheatsheet
Anonymous
def sentence(request, pk, df): curr = request.user # some code if request.method == "POST": print('1') user = request.POST.get('sentence', None) index = int(request.POST.get('index', None)) print(user) return redirect(".") ctx = { ... } return render(request, 'html/correct_sentence.html', ctx) <form method="POST" action="{% url bu yerda url tug'ri %}"> {% csrf_token %} <div style="margin-left: 30px;"><h5>{{ ph }}</h5> <input required name="sentence" type="text" id="char1"> <input required name="index" type="number" value="{{index}}" id="index" hidden> <button type="submit" class="btn btn-primary">Check</button></div> </form>
Abolfazl
Yes
did you end it?
Anonymous
did you end it?
was seen in the window. when the submit problem button is clicked. request.method == 'POST' does not work
Abolfazl
was seen in the window. when the submit problem button is clicked. request.method == 'POST' does not work
i dont know, maybe its bcuz you write post in uppercase in html turn it to lower case
Saman
I have a serializer for user (custom user with unique email field): class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ("email", "first_name", "last_name", "is_active", "role", "cell_number") And I used this serializer as NestedSerializer in other serializers like that: class PersonInChargeSerializer(serializers.ModelSerializer): id = serializers.IntegerField(required=False) user = UserSerializer() class Meta: model = PersonInCharge fields = "__all__" read_only_fields = ("entity",) But in PATCH REQUEST of serializers who have NestedSerializer field of user, when send current email of user, I get this error: user with this email address already exists. Does anyone have a solution?
Rose
User DA has 1/3 warnings; be careful! Reason: crosspost
Lords
Hello everyone I am looking to intigrate payment gateway for my django e-commerce project if anyone have idea about how it will work ,data security like that things please give clarity about it
Lords
Try any payment gateway service they will handle everything of you start from scratch that's different process
But how data security the gateway providers will take care about it or we need to take care
Lords
Like credit card information like that things.
Sagar
Hello I have opened the default the admin page 127.0.0.1:8000/admin/ And if I copy paste the above link and I try to open in new tab it gets opened I want to avoid the above scenario How it can be achieved
Poya
Hello, When I want to upload another file in the product section through class file, it gives me this bug and the product does not save. I talked to the AI for a bit, but I couldn't explain it well enough to solve my problem. Of course, this is not without effect that I did not realize my problem :))))))
Abhi
But how data security the gateway providers will take care about it or we need to take care
You use django security like csrf that's handle the all things if I am not wrong
Abhi
But how data security the gateway providers will take care about it or we need to take care
Mostly payment gateway take care this like razorpay if you want to create a different for your data that u will handle it
Abhi
So payment gateway handle all security
SK
need help to save the input values in database.. as am getting below error and values are not saving Exception Value: Field 'id' expected a number but got
Nasrullah
Can someone exactly explain difference and usages of onetoone field and foriegnkey field in django please?