Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Jul 14 16:11
    @MadLittleMods banned @Rehmanjeff
@matrixbot it was not
how can i export a user to pdf
is there a solution
qamarali I think you want to export user data from model to PDF,
So check it out this link
yes in admin panel @matrixbot
Yorman Aguirre
I'm Django developer, new in the community
Happy to be here :D
Alejandro Duque Correa
Hi @yaguirre from medellin col :)
Hi everyone! I’m a django beginner (generally a beginner dev)
I have a question. I’m working through yet another guided project. This time Django Girls. In other projects, everyone simply put the app name into settings.py file, in INSTALLED_APPS. Django Girls did ‘blog.apps.BlogConfig’. What does the .app.BlogConfig part change? I assume it must be created as it’s a custom name, but is there any difference if I just put an app name?
So in this case ‘blog’ vs. 'blog.apps.BlogConfig'
qamarali This link will definitely help you out...
El 李天宝
@dotbrt What ever your PYTHON_PATH can read
@dotbrt hi the "blog.app.BlogConfig" means from app.py in blog folder read the name if the app name.
thisisshub Can somebody help me with "how to set the STATIC_ROOT in settings.py". I am trying to deploy my app on heroku but I keep getting error Error while running '$ python manage.py collectstatic --noinput'. even though I do have a STATIC_ROOT path in my setttings.py

I have a dictionary which contains one item (“current_location”, which is a nested dict) and I would like to access that nested dict. However, I cannot use the key as the code will break if a different key is passed, e.g. “different_location".

How can I access the first item in a dictionary without using a key? The dict looks like this:

{'current_location': {'date': '2020-01-27T10:28:24.148Z', 'type_icon': 'partly-cloudy-day', 'description': 'Mostly Cloudy', 'temperature': 68.28, 'wind': {'speed': 10.48, 'bearing': 178, 'gust': 12.47}, 'rain_prob': 0.02, 'latitude': '-33.927407', 'longitude': '18.415747', 'request_id': 31364, 'request_location': 'Current location'}}

Got it. I used dict[next(iter(dict))]
James Komo
Anyone who is familiar with using set.all in django in One-to-many relationship tables?

I have these two models

class Project(models.Model):
    project_name = models.CharField(max_length=100, blank=False)
    description = models.TextField(max_length=500, default=None)
    postedOn = models.DateTimeField(auto_now_add=True, blank=True)
    Owner = models.ForeignKey(User, on_delete=models.CASCADE)
    isCompleted = models.BooleanField(default=False)
    deadline = models.DateTimeField(blank=True, null=True)
    task_count = models.IntegerField(default=0)
    attachments=models.FileField(default='Project Attachments', upload_to='tasks_docs', validators=[validate_file_extension])

    def __str__(self):
        return self.project_name

class Task(models.Model):
    task_name = models.CharField(max_length=50, blank=False)
    addedOn = models.DateTimeField(auto_now_add=True, blank=True)
    project = models.ForeignKey(Project, on_delete=models.CASCADE, default=1)
    rating = models.DecimalField(default=0, max_digits=2, decimal_places=1)
    amount = models.IntegerField(default=0)
    task_description = models.TextField(max_length=1000, default=None)
    task_link = models.URLField(blank=True)
    latest_submission_time = models.DateTimeField(blank=True, null=True)
    isCompleted = models.BooleanField(default=False)
    deadline = models.DateTimeField(blank=True, null=True)
    task_attachments=models.FileField(default='Tasks To Do', upload_to='tasks_docs', validators=[validate_file_extension])

    def __str__(self):
        return self.task_name

And I am looking for a way to access tasks based on project. I can select a specific project and view its tasks

Mihail B
@jameskomo try this:
project = Project.objects.get(id=123).prefetch_related('task_set')
you can also specify related_name for project property in Task
Dipto Karmakar
Hi ,
Is there anybody who can provide me some good resources for implement social authentication in Django-rest api?
Thanks :)
El 李天宝
Supposed you have new feature that need geoDjango which is rely on postgist
Will you add extension to existing database and work with it or split it out to be new microservice over REST API?

Hi, I have a quick question.

Say I have models called "Post" and "Reaction" and I have made a Post, saved it and now I want to react on it with a Reaction.
Now, when I visit my feed where a list of Posts is, I want to show my reaction if I had one.

Which means:
{% if post.my_reaction %}{{ post.my_reaction.contents }}{% endif %}
Now, obviously I want to load more than just one Post; posts which don't have my reactions on it.

I know that I used to solve this with SQL in PHP with
LEFT JOIN Reaction ON Reaction.Post = Post.id
How do I do this in Django ORM ??
Hello everyone, i newbie and have some basic sites on django, pls suggest good book about django :)
m8, there's so much material online...
Did you try following the tutorial that Django provides on their Website?
I think i past that, have more that 2 basic sites, seek for book like 'Fluent Python'. btw don't really bother with it, just asking
Python or Django??
about Django, same level as 'Fluent Python' to python. More like reference book, with in-deep stuff
Hmmm I don't know anything like that.
Nwm :)
you should try the book "building django 2.0 web applications"
it's very detailed and touches on alot of concepts
Falgun Swami
i need some help building an api with django
can anyone help me out
Falgun Swami
Shay Tessler
Hello Django community, I created a new response object based on StreamingHttpResponse for bundling, streaming React, etc.. and more easily
I am still thinking of a logo any ideas?
I want to know something about using the postgres specific ArrayField:
If I have lots of related data that only ever is accessed by that relation would the ArrayField give me better query performance than an extra table?
Let's say I have 1000 rows and each one would have an ArrayField with an average length of 100...
Something tells me that a 100,000 row long table can't be good, right?
@NikiSchlifke why can't that be good?
databases are made to store large (very f'ing large) amount of data and still perform fast when it comes to reading data from it
How can I add my custom themes in Django ?
anyone ?
@AlbertDavid94 AFIK a SQL join is O(n*m) complexity if there's no index on either of them, so no.
And I can't rely on indexes since I will be adding new rows every time the user uses the app.
This kind of performance problem has been occurring sporadically on every project I've worked on.