Alex
Alex
can you share your codebase?
park seo joon
I have specified the views and template should I specify the model aswell?
Alex
well, codebase is needed for reproducing the issue.
Alex
park seo joon
I'm coming
park seo joon
Class Post(models.Model)
user = models.ForiegnKey(User, on_delete=models.CASCADE)
post = models.FileField(upload_to='post', default=None)
caption = models.TextField(max_length=300)
date_created = models.DateTimeField(auto_now_add=True)
no_of_likes = models.IntegerField(default=0)
objects = PostManager()
def str(self)
return self.user.username
class PostManager(models.Manager):
def create_post(self, user, post, caption):
post = self.create(user=user, post=post, caption=caption)
return post
park seo joon
Alex
Class Post(models.Model)
user = models.ForiegnKey(User, on_delete=models.CASCADE)
post = models.FileField(upload_to='post', default=None)
caption = models.TextField(max_length=300)
date_created = models.DateTimeField(auto_now_add=True)
no_of_likes = models.IntegerField(default=0)
objects = PostManager()
def str(self)
return self.user.username
class PostManager(models.Manager):
def create_post(self, user, post, caption):
post = self.create(user=user, post=post, caption=caption)
return post
from django.db import models
from django.contrib.auth.models import User
class PostManager(models.Manager):
def create_post(self, user, post, caption):
post = self.create(user=user, post=post, caption=caption)
return post
class Post(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
post = models.FileField(upload_to='post', default=None)
caption = models.TextField(max_length=300)
date_created = models.DateTimeField(auto_now_add=True)
no_of_likes = models.IntegerField(default=0)
objects = PostManager()
def __str__(self):
return self.user.username
park seo joon
Alex
park seo joon
park seo joon
Thanks alot
Nick
Good day!
Does anyone have a ready-made template or a GitHub repository that can be used as a basis for developing a website?
I want to avoid having to implement pages for login, password recovery, account settings, and so on.
The most suitable would be a prototype website related to file storage, similar to Google Drive.
cj
Priyanshu Pratap
Hey can i use django inbuilt authentication and integrate it with nextjs?
Priyanshu Pratap
Charly
For drf yes.
Priyanshu Pratap
Drf auth
Priyanshu Pratap
For drf yes.
Bro is i have to use JWT for it? Can't i use django inbuilt authentication??..i am not much familiar with drf
Maroua
i want some help with the login in dajngo please , i did the template and the urls also the views the only thing left is how to get the user's infos from the html template so it shows on the data base in /admin ?
Alex
Priyanshu Pratap
Ibnu
Is there anyway to get tags like nav_link .. I mean I make custom but if I want many component it's going to be difficult
Charly
Ibnu
How can I say
If this link is active make this styling otherwise this is the default..
Ritik Sharma
I had connected django to mongodb.
1. When I first import json file to db containing 1k data and when user input the data by post method then data is not showing to the database
2. When firstly user input the data though post method that data is stored in database after that if I'm importing json file in same database it is showing error (E11000 duplicate key error collection)
I'm unable to slove this error help me out plz..
Marc
hello everybody,i need the help for corrige my code. this is my error: UnicodeEncodeError at /contrat-pdf/13/
'latin-1' codec can't encode character '\u2019' in position 475: ordinal not in range(256)
Dexter Spectre ࿗
can you help me find why in pages with csrf when i using my api , i got 400 status code with json parse error?
The IT
MD QASIM
HTML full course PDF any one does have
Bekzod Juraev
Guys give me advice.Which these options good approach (Custom user model or link new profile model to user)???
cj
Bekzod Juraev
I did second approach linking to user because it was simple but people saying it is not good approach
cj
probably you forgot to add enctype="multipart/form-data" to your <form> tag
Bekzod Juraev
Mehdi
Mehdi
Thanks 😁🌹❤️
Love Berlin
Hello , I am using django with uwsgi, and python version 3.8 , from last 2 years I had no issues , all of a sudden I am getting uwsgi. Worker died and segmentation fault issue , did anyone experienced this issue ? Any solution?
Charly
Love Berlin
Any on the logs?
Full logs , I am unable to share , but here is the actual main log ——-DAMN ! worker 1 (pid: 707) died : ( trying respawn ...
Respawned uWSGI worker 1 (new pid: 711)
DAMN ! worker 2 (pid: 708) died : ( trying respawn ...
Fri Jul 5 19:22:22 2024 - [emperor] vassal abc_new
Respawned UWSGI worker 2 (new pid: 712)
DAMN ! worker 4 (pid: 709) died : trying respawn ...
Respawned uWSGI worker 4 (new pid: 713)
DAMN ! worker 3 (pid: 710) died : trying respawn ...
Respawned uWSGI worker 3 (new pid: 714)
!!! UWGI process 712 got Segmentation Fault !!!
!!! uWSGI process 714 got Segmentation Fault !!!
!!! uWSGI process 713 got Segmentation Fault !!!
!!! UWSGI process 711 got Segmentation Fault !!!
Maroua
Maroua
Parsa
Django auth or drf auth?
How to get the values form request if i post in view
Curl ..... _p
def all_data(request):
return JsonREsponse(request.)
Pedram
Haleem
Anyone use onesignal to send transactional email like sending email for change password, new account and all from website. It seems onesignal is cheaper than sendgrid
Taha
Hi guys 😊
How can I connect one thing with post method from js to Django view?
The Inspired
Taha
Nope
Just JavaScript vanilla
The Inspired
ok ok
The Inspired
plain django provides both frontend and backend
The Inspired
if you want to use Django only as an API provider, take a look at DRF
The Inspired
https://www.django-rest-framework.org/
The Inspired
technically, you can write HTML, CSS and JS inside Django only
Ваня
Hi, for some reason django not return data from db, pls send help
Ваня
No errors in sight
Ваня
Even if i just accessing a variable directly through jinja i get this <QuerySet []>
Ваня
https://hastebin.com/share/yidufepala.bash
Moderator
I want to start django framework with rest API anyone suggest any YouTube channel??
Mehdi
Bruh is there anyway to give a request,POST a name ? i got 4 form with POST method in ONE PAGEE
Emmanuel
Priyanshu Pratap
I am not able to use session variables in django i did all preliminary steps like configuring middleware and engines and session age as well but still its not working. I am using mysql as a database and using nextjs as frontend and django as backend...please help
Doragonsureiyā
Jason
Mehdi
use unique field names for each form
html : <form class="row" action="" method="POST" enctype="multipart/form-data"> and views : if request.method == 'POST' : how yo use ? 😅
Kasem
How can I solve template page not found in class based views?
ㅤㅤ
Guys how python django framework use in web development
ㅤㅤ
?
Mirco