vhuramai
Hello everyone, im doing a certificate with pathway, can any recommend a book explaining functions
Heron
vhuramai
I watch a few tutorials, Mosh being very inspirational and clear but i have a few holes to fill
♣️Ⓐⓡⓜⓘⓝ💻
How can i make the admin panel ???
With which code ??
iNeedHighMove
CAB ඞ
Hello, does anyone here has worked with pusher and django?
I have a opened and bountied question in stackoverflow related to auth to a private channel, I need help with that. I don't write the question here because it is too large and requires code to explain it
https://stackoverflow.com/questions/71450227/pusher-autenticated-users-not-receiving-events-from-private-channels
♣️Ⓐⓡⓜⓘⓝ💻
iNeedHighMove
??
Use Google.com
It's helpful
https://realpython.com/customize-django-admin-python/#:~:text=You%20can%20fully%20customize%20the,templates%20used%20to%20render%20pages.&text=The%20Django%20template%20engine%20has,directory%20structure%20and%20file%20names.
♣️Ⓐⓡⓜⓘⓝ💻
Mika
Who know how to remove slash in the routes?
I put append_slash = False
And its not working
Raj
Hi, I am working on Abstract base class model inheritance topic. How can I override one of the abstract base class fields to be removed with None in a child class ?
Heron
vhuramai
Thank you so much, i will try his tutorials
Lambda
hi. im got two models: Links and Sublinks, field Sublinks.parent reference to Links model:
parent = models.ForeignKey(Links, on_delete=models.CASCADE)
in rest serializer i wrote:
parent = serializers.RelatedField(source="Links.text",read_only=True)
field parent no such in server response. how to fix?
Брат
Model creation bypasses the validators in models.py
test.py :
Model.objects.create(rate=6)
models.py :
class Model(models.Model):
rate = models.SmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(5)], ....)
...
Xeno
Lambda
Xeno
It worked, right?
Lambda
It worked, right?
I don't remember anymore. I did it differently and am already engaged in another part of the project
Lambda
Sorry for that, there's just a lot to do and I'm already tired. the project is urgent
Xeno
Cool. take care
hm
what's the best Django/Python e-commerce repo on GitHub that's open source and is fully customizable with external API's
hm
.?
Maksim
Брат
😒😒
I'm trying to redirect the currently logged in user to a different page if he doesn't have a particular item stored in the db
if Restro.objects.get(user=request.user).count() == 0:
redirect('store')
else:
#...
I've also used .exists(), didn't work
Still says Restro matching query does not exist
Kamronbek
Dilipkumar
Kamronbek
Cabrel Tchomte
possible to learn DRF directly?
Ali
Cabrel Tchomte
as nowadays, the most apps run like frontend + backend
Ali
If you can have DRF without Django installed, maybe.
Cabrel Tchomte
it's really necessary to learn all django?
Cabrel Tchomte
as backend, someone can just learn DRF, not so?
Cabrel Tchomte
Ali
it's really necessary to learn all django?
DRF acts like a microframework that runs on top of the Django itself. You gotta be familiar with Django first. You need to be familiar with MVC and MVT. Basics. OOP and stuff. In DRF, you have a lot of other topics you won't ever check as a full Django developer (who works with template engine and stuff).
Ali
Like there is no template engine at all. You have your django tests, views, serializers, settings, migrations, and tons of features that Django actually support as well as DRF does.
If you're looking for the possibility to learn, I would say yes for sure. You can learn whatever you want but the thing is that you will face a lot of topics in DRF courses and documentations that refer to the official Django docs.
Cabrel Tchomte
ok thanks for advices. 👌
Pravalli
I created virtual environment on command prompt but I cannot access virtual environment in visual studio code
Zhalgas
Hello. I have a question, how can I find out about adding new records to the database?
Yaquier
Yaquier
Later, you can change the default python interpreter to the created recently inside the venv and the VSC automatically start it on the run
Yaquier
Pravalli
Pravalli
Pravalli
I got it
Manish
Hi, I created a register template and I'm trying to register data with sqlite3 only. It's also showing table in admin. But data is not saving into database. Register template is not redirected to login template. Help me to solve this issue
😒😒
You're welcome
In my app, when a new user signs up, there are errors because I'm calling some model objects that every registered user needs to have, so when a new user signs in, he doesn't have any of these data, the model object returns an error
Do you know how I can handle this?
To make only the needed data that the currently authenticated user has to come up instead of returning everything
cr
Morteza
Shivam
😒😒
😒😒
Morteza
Mika
Hello, what is the filename co vention for model?
book.py or book_model.py?
༒ROHIT
Gerald
Hi keep getting this error:
Gerald
TypeError at /admin/carts/cartitem/7/change/
str returned non-string (type Product)
Doragonsureiyā
To share code or error tracebacks, use a pasting service, like:
- https://linkode.org
- https://dpaste.org
Gerald
class CartItem(models.Model):
product = models.ForeignKey(Product, on_delete=models.CASCADE)
variations = models.ManyToManyField(Variation, blank=True)
cart = models.ForeignKey(Cart, on_delete=models.CASCADE)
quantity = models.IntegerField()
is_active = models.BooleanField(default=True)
def sub_total(self):
return self.product.price*self.quantity
def __unicode__(self):
return self.product
Morteza
Моджтаба
Hi
I want to have a shamsi datetime selector in my django admin panel.
It all shall be in my custom form, which you can see down here.
class CustomFooForm(forms.ModelForm):
class Meta:
model = Traffic2
js = ('static/dashboard/js/custom.js',)
fields = [
'num', 't',
]
widgets = {
't': forms.DateInput(attrs={'id':'datepicker'}),
}
Any ideas?
Github
please help, maybe someone knows how to do this: Authorization by phone number. The first request to enter a phone number. Simulate sending a 4-digit authorization code (1-2 sec delay on the server). The second request to enter the code
Neo
theDisgrace
Gerald
Kukushka
👋👋👋Hello. please help with sorting.
How can I sort "question" in "theme" order.
(not alphabetically)
https://pastebin.com/raw/XzeT5ScQ
ㅤ
salar
I think I'll make use of signals instead
Thanks so much
you can make it in your Users model
def save(self, *args, **kwargs):
if not self.id:
#create the user
userobject =super(Users, self).save(*args, **kwargs)
#create some related models
Somemodel.objects.create(userobject,...)
return userobject
else:
return super(Users, self).save(*args, **kwargs)
f
https://stackoverflow.com/questions/71563426/how-to-display-a-pdf-in-django-admin-instead-of-the-link
Harsh
I had a error in payment gateway integration
Harsh
Can anyone help
Harsh
AES length error 17 bytes