() { :;}; echo Nickolas
Thank you a lot!
np, happy coding
Kavya
have you given space between % and extends if not then try giving space
Solved. Was problem with template try in another template so it's working well
Kavya
I've issue with importing JWT in django rest framework.anyone can help
Kavya
Error is "import "rest_framework_simplejwt" could not be reloved
Abrar Abu
I have to add fields in serializer and which are not part of model how do I achieve that Example is during sign-up Password and confirm password i can take as input and save only password I want to achieve this this in django rest framework
Mirco
I have to add fields in serializer and which are not part of model how do I achieve that Example is during sign-up Password and confirm password i can take as input and save only password I want to achieve this this in django rest framework
class SignUpSerializer(serializers.Serializer): ... password1 = serializers.CharField(write_only=True) password2 = serializers.CharField(write_only=True) just don't use a ModelSerializer for it
bansh
I have to add fields in serializer and which are not part of model how do I achieve that Example is during sign-up Password and confirm password i can take as input and save only password I want to achieve this this in django rest framework
class SingupSerializers(serliazers.ModelSerializers): class Meta: model=User def validate(self,validate_data): if validate_data.get('password',None)!=validate_data.get('oldpassword',None): raise "password similar" def create(self,validate_data): if self.validate(validate_data): del validate_data.get('oldpassword') instance=self.Meta.model.objects.create(**validate_data) instance.save() return instance
bansh
May be it will be work.
GLuko
Yo guys, can someone helps me?
GLuko
I have this error 'DiscordUser' object has no attribute 'is_active'
GLuko
when I went to my admin page
GLuko
class DiscordUser(models.Model): objects = DiscordUserOAuthManager() id = models.BigIntegerField(primary_key=True) discord_tag = models.CharField(max_length=100) avatar = models.CharField(max_length=100) public_flags = models.IntegerField() flags = models.IntegerField() locale = models.CharField(max_length=100) mfa_enabled = models.BooleanField() last_login = models.DateTimeField(null = True) def is_authenticated(self,request): return True
GLuko
I only have this model and class DiscordUserOAuthManager(models.UserManager): with class DiscordAuthenticationBackend(BaseBackend):
GLuko
how to fix this?
Alex
So, I should make specific modal for admin?
No, check migrations and all relationships
GLuko
No, check migrations and all relationships
My admin wants to get data from my own auth not from data by default
GLuko
how to change this?
Maxim
My admin wants to get data from my own auth not from data by default
you just ignored the message you replied to? why do you ask questions if you ignore the answers?
Of course
Hello , why in Comment form don't raise error_message when I remove required in inspect ellements and leave input field empty or space?
Anonymous
match action: ^ SyntaxError: invalid syntax i am using python 3.10.5 version and i have 3.10.4 in my runtime.txt
Of course
add validator in form backend
I just want when user_name input is empty raise a error massage but don't raise. in my previous project error was raised default
Alex
I just want when user_name input is empty raise a error massage but don't raise. in my previous project error was raised default
that form maybe was created by using model form,thus making it have empty field validator by default.
Of course
that form maybe was created by using model form,thus making it have empty field validator by default.
but that form used from DetailVeiew class for view but this form used View class for view. this reason can be ?
Of course
no
so why this form don't raise error massage?
Alex
share your codebase.
Krushna
Integrated slack with django, used block's static select option in chat_postMessage. I've got request_url payload for static_select options. When I select any one option I get response and if I select other option I'm getting response for that too. How can I make it select only one option and then disable the dropdown menu so that it won't be selected again?
Of course
share your codebase.
class Comment(models.Model): user_name = models.CharField(max_length=30, null=False) email = models.EmailField() text = models.TextField(max_length=400) post = models.ForeignKey( Post, on_delete=models.CASCADE, related_name='comment') def __str(self): return self.user_name__
Of course
share your codebase.
class CommentForm(forms.ModelForm): user_name = forms.CharField(required=True) class Meta: model = Comment # fields = 'all' exclude = ['post'] labels = { 'user_name': 'Your Name', 'email': 'Your Email', 'text': 'Your Comment' } error_messages = { 'user_name': { 'required': 'You must enter a user name.' } }
Of course
no
<section id="comment_form"> <h2>Your Comment</h2> <form action="{% url 'post_detail_page' post.slug %}" method="POST"> {% csrf_token %} {% for field in content_form %} <div class="form-control"> {{ field.label_tag}} {{ field }} {{ field.errors}} </div> {% endfor %}
Of course
I dont't have user model
I just have Post model
Alex
I dont't have user model
your project doesn't have user auth and management?
Of course
Of course
then in user_name simply add blank=False
by default blank and null is False
Bhaskar
I need help in django project
Bhaskar
Plz help me
Jagadish
Hi
Jagadish
What help do you need
𝙰𝚜𝚑𝚠𝚒𝚗
I need help in django project
not until you explain your problem
Bhaskar
My project is run but when i am giving data in registration form but data is not passing to MySQL
Jagadish
My project is run but when i am giving data in registration form but data is not passing to MySQL
Check the form valid and see if you are doing form.save(), If the form is not a model-form you have to ask data manually
Bhaskar
The current path , register, didn't match any of these
Jagadish
Maybe send a screenshot of error
Bhaskar
Sending media is off in this group
Jagadish
Sending media is off in this group
You can send link, upload image somewhere
Alex
by default blank and null is False
share entire codebase if possible(use github).
Maxim
You can send link, upload image somewhere
please don't give bad advises specialized text services (like https://linkode.org, https://nekobin.com) should be used for text information
Bhaskar
Now giving MultiValueDictkey Error
Erkaboy
Hi all. I'm going to make project in DRF like this: user gives an order and it should be seen for workers in real time. So I need some advices for that. Shuold I use channels or some thing else?
Erkaboy
I couldn't figure out what to do.
cj
But it is mobile app I'm writing it's backend in DRF.
it doesn't matter, you can connect to websockets either way
cj
I couldn't figure out what to do.
if you really want to be stuck with DRF, them you may make an endpoint end poll to it from your client, but don't expect good performance while doing that when you have a high load from many clients ¯\_(ツ)_/¯
Erkaboy
it doesn't matter, you can connect to websockets either way
I thought it is different in drf. Because I couldn't find how to test it. Shuold I test in with js again?
cj
I thought it is different in drf. Because I couldn't find how to test it. Shuold I test in with js again?
you don't need JS, but if you want to... ¯\_(ツ)_/¯ you can simply use the language your using in your mobile client app (Java/Kotlin/Swift/Dart) to connect to a websocket and use it
Марк
Hello. https://pastebin.com/yXZuNxEt need help. You need to write a script in a file migration that ProfileSettings are created for all profiles (that have already happened) Here's what I got https://pastebin.com/p6gAmeGm The migration takes place in the database of nothing enterprise.
GLuko
I start my project from start and I can easly connect to localhost:8000/admin but when I try to use my model for discord I have problem: 'AnonymousUser' object has no attribute '_meta' I found that when I put 'django.contrib.auth.backends.ModelBackend',(standart auth) and 'oauth2.auth.DiscordAuthenticationBackend', (discord oauth) when I login into discord all works fine but when I go to my admin site I have error 'DiscordUser' object has no attribute 'is_active'
Alfonso
Ok, I want to add a field to an existing table, I read that shemaeditor has a function to do that but I can't make it work.
Maxim
Ok, I want to add a field to an existing table, I read that shemaeditor has a function to do that but I can't make it work.
still not enough information to help you please show your code (don't forget rule #5) and tell what you're trying to achieve that doesn't work the way you expect
Alfonso
with connection.schema_editor() as shema: last name = models.Charfield(max_lenght=15, null=True, blank= True) schema.add_field(My own model, lastname) And the error is 'Charfield' object has no attribute 'column'
Krushna
Hello. I'm using slack's interactive messages: static select menu option inside blocks of chat_postMessage to send message to channel. I'm getting payload from request_url when anyone select one of the options. I'm sending selected option to db. Problem is once I select a option, an entry is added to the db and when I select it again it gets saved again. Whit I want is: once an option is selected then select menu should be disabled i.e. we shouldn't be able to select any options. So far I've added confirm and deny options for selection but still I can select any option as many times I want to. Maybe I'm bad at searching but I didn't get results related to this. Anyone would like to suggest something?
GLuko
I start my project from start and I can easly connect to localhost:8000/admin but when I try to use my model for discord I have problem: 'AnonymousUser' object has no attribute '_meta' I found that when I put 'django.contrib.auth.backends.ModelBackend',(standart auth) and 'oauth2.auth.DiscordAuthenticationBackend', (discord oauth) when I login into discord all works fine but when I go to my admin site I have error 'DiscordUser' object has no attribute 'is_active'
GLuko
It is discord problem. Check your profile
nope, when I try to go my admin site, django use backend for Discord