Anonymous
Anonymous
here's the scenario: I have a profile model with relation to user as onetoonefield. class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) firstname = models.CharField(max_length=200, null=True) lastname = models.CharField(max_length=200, null=True) ... and now i want to filter all profile data that belongs to specific group in auth_group using the User.
I don’t even think that creating a firstname and lastname is useful because you’re having a one to one relationship with the user model, based on that you already have a column for those fields already. And to look up the group, you have to use filter and double underscores to be able to enter the group table and find the column you need within the table
Bunty chhatri wala..
Pls give me the solution
https://moonbooks.org/Articles/How-to-get-visitor-ip-address-with-django-/
Anonymous
What is use of Meta class in django
Meta class: This is a class instance. normally, an obj can be called a class instance but when you use class meta within your class, you’re simply telling python that you want to modify the current class, hence you create an instance of itself.
Anonymous
I don’t know if you understood me
Anonymous
But you can ask more questions if you want
Hello world
hello everyone, i want to use social media icons in django email templates , how to use this icons?
Momin
hello everyone, i want to use social media icons in django email templates , how to use this icons?
I am not a pro but you can use FontAwesome to add icon of social media. Just link you template and copy any ico you want
Anonymous
i have a doubt. i have one app with side bar. and have 20 pages. this side bar is partial so i include it in all html. jinja2 templates. now my problem is i need to show some data in the side bar which is from database. do i need to pass this data in context of the template from. every class base and function based view?
Anonymous
what would be the correct approach of this
Anonymous
can anyone explain me how it should be done. i dont think its good idea to write this at 20 different views and functions. cuz they would return different html template
Rodolfo
I am not a pro but you can use FontAwesome to add icon of social media. Just link you template and copy any ico you want
You should use inline css for styling. And try the svg versions of the icons. Because the email client, ie. Gmail, will block any images.
Anonymous
template tags?
Anonymous
cool thanks
Anonymous
let me check
Mehmet
I generally create helpers.py and create methods inside with register.simple_tag decorator and use that in templates these kinda workarounds.
Mehmet
Actually this is a bit against MVP structure but I think we all need workarounds sometimes.
Hello world
I am not a pro but you can use FontAwesome to add icon of social media. Just link you template and copy any ico you want
i tried that but when i send email, social media icons does not appear in that email body.
Anonymous
i m returning list from custom tag buy not able to iterate over iy
Anonymous
it
Anonymous
any idea what could be done
Anonymous
when i print in {% %} it shows me the list
Anonymous
but i m not able to use for loop on it
Amos
Hi guys am trying to set up database on a cookiecutter project, however I keep getting set tge DATABASE_URL=postres://... environment variable error, have already exported that variable using the export DATA..., any one with an idea?
Anonymous
I need help fixing this error TypeError: blogposts() missing 2 required positional argument: 'request' and 'slug'
ZK
Why my bash console in virtual env is unable to detect my changes in the model.. I'm using pythonanywhere
ZK
When I run python manage.py makemigrations, it says no changes detected
Anonymous
ZK
There is no migration directory in production
Mehmet
Delete your migrations file
No it is not the case, then you may face more complex situations.
Mehmet
Maybe your app is not in the INSTALLED_APPS?
ZK
It is in production
Mehmet
It is hard to debug the issue unless settings.py, directory structure including migrations and django_migrations table are seen
ZK
i don't see any migration directory here.
inchidi
https://blog.jetbrains.com/pycharm/2020/08/webinar-django-database-performance-tips-with-andrew-brookins/
Ujjwal
Please someone suggest any good minor projects they have made or anything related to python django ? U can dm me also
Tins
Hi, how can I connect django to mongodb ??
Curious
Can anyone tell me how could I pass a list to html page in Django 3.
Tins
Can anyone tell me how could I pass a list to html page in Django 3.
You can use List=[1,2,3] render(request,'index.html',List)
sravan
How to add sample respons in redoc open api ? I using drf_yasg packing
Anonymous
Hello Anyone Familiar with HUGO?
Curious
Thanks but I'm getting such error
I mean context must me a dict rather then list
Curious
I mean context must me a dict rather then list
It says we have to pass a dictionary but I need to send a list
Curious
Okey thanks
Anonymous
Hello guy's
Anonymous
I have one issue in Django That is I want to access objects name which I am pass in render method of one function to another function body
Anonymous
What is the way?
|| VISHAL
may i get django full course from beginning. if you've availabe then please contact with me.
Anonymous
Anyone?
Akash
Hello guys... can you please help me with Django filters option
Gil
Anyone?
The question is about django language template / jijna2 ?
|| VISHAL
|| VISHAL
i need full course of django
Anonymous
please i need full couse
there is no full course other than documentation in fact))
|| VISHAL
How will I get it?
|| VISHAL
???
Anonymous
please i need full couse
try learning django basics from free online courses like udemy, there is no full course, you learn everything then gradually, first start from scratch
Anonymous
The question is about django language template / jijna2 ?
It's about calling functions members in another function In views.py file
Anonymous
Akash
Hello everyone. I am a beginner in Django but willing to learn it. I want help from the community on below items: 1. Use of Django-filters to filter charts/table built on models 2. User input form to take simulation inputs 3. Alter the data stored in models basis the user input 4. Run the ML model from front end. 5. Refresh the charts and everything with the new output Any help is appreciated!
Rodolfo
i tried that but when i send email, social media icons does not appear in that email body.
Try inline css for styling. And the svg versions of the icons. Because the email client, ie. Gmail, will block any images.
Yash
I am using ImageField attribute to upload images in the db . But the file is not saving in the db . Can anyone help me with this. I am using class based views
Anonymous
anyone here tried soft delete? how to achieve it in django. i want something to be deleted. but it is in foreign key relationships. now i want if it is deleted it should not be visible from client side. but customers side it should be visible. think it as a product product owner and customer. customer bought some product so in. customer Purchases column i have it as relation. but if product owner deletes it, it would be removed from. customer end.
Anonymous
can anyone help me with this scenario
Mehmet
You may use two boolean fields as a flag such as visible_to_customer and visible_to_client.
Mehmet
You may change these flags on all delete business logic.
Anonymous
7777 members and 888 online😍
Anonymous
nope. if a product owner deletes a product iy should not get delte from customer