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
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
User J has 1/3 warnings; be careful!
Reason:
crossposting
Emre
Solomon
ali
Does anyone know why django still uses template system which is not used anymore, Nowadays, backend developers use apis and microservices?????!!!
Charly
Muflone
Husen
ImportError: Module 'authentication_user.apps' does not contain a 'AuthenticationUserConfig' class. Choices are: 'AuthConfig'.
#help
Mirco
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
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
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.
ERF4N
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
Mr. Achiever
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?
In addition to this, if you're using Class based views, you can use LoginRequiredMixin and PermissionRequiredMixin as well.
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
Maxim
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>
Anonymous
Maxim
Anonymous
Abolfazl
Anonymous
Abolfazl
Anonymous
did you end it?
was seen in the window. when the submit problem button is clicked. request.method == 'POST' does not work
Abolfazl
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
ali
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?
Could u send your model?
And let me say something about nested serialization in the put, patch, and post methods. These have a heavy structure for updating. So I really recommend using a rest-framework-generic-relation package, which is suggested by rest framework documentation. https://github.com/Ian-Foote/rest-framework-generic-relations
This package handles the update and create, process for every update, and create methods
ford
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
Abhi
Lords
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
Eric
Charly
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 :))))))
Poya
Abhi
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
Sagar
Rose
Abhi
Nasrullah
Can someone exactly explain difference and usages of onetoone field and foriegnkey field in django please?