by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Yorman Aguirre
    @yaguirre
    Hi
    I'm Django developer, new in the community
    Happy to be here :D
    Alejandro Duque Correa
    @aleducode
    Hi @yaguirre from medellin col :)
    dotbrt
    @dotbrt
    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'
    matrixbot
    @matrixbot
    qamarali This link will definitely help you out...
    https://docs.djangoproject.com/en/3.0/ref/applications/
    :]
    @elcolie
    @dotbrt What ever your PYTHON_PATH can read
    Reza_XD
    @rezaxd
    @dotbrt hi the "blog.app.BlogConfig" means from app.py in blog folder read the name if the app name.
    matrixbot
    @matrixbot
    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
    SD
    @dubesoftware

    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'}}

    SD
    @dubesoftware
    Got it. I used dict[next(iter(dict))]
    James Komo
    @jameskomo
    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
    @mihailb1_gitlab
    @jameskomo try this:
    project = Project.objects.get(id=123).prefetch_related('task_set')
    project.task_set.all()
    you can also specify related_name for project property in Task
    Dipto Karmakar
    @dipto0321
    Hi ,
    Is there anybody who can provide me some good resources for implement social authentication in Django-rest api?
    Thanks :)
    :]
    @elcolie
    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?
    AlbertDavid
    @AlbertDavid94

    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
    SELECT * FROM Post 
    LEFT JOIN Reaction ON Reaction.Post = Post.id
    How do I do this in Django ORM ??
    Zen
    @master-of-zen
    Hello everyone, i newbie and have some basic sites on django, pls suggest good book about django :)
    AlbertDavid
    @AlbertDavid94
    m8, there's so much material online...
    Did you try following the tutorial that Django provides on their Website?
    Zen
    @master-of-zen
    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
    AlbertDavid
    @AlbertDavid94
    Python or Django??
    Zen
    @master-of-zen
    about Django, same level as 'Fluent Python' to python. More like reference book, with in-deep stuff
    AlbertDavid
    @AlbertDavid94
    Hmmm I don't know anything like that.
    sorry
    Zen
    @master-of-zen
    Nwm :)
    mokom
    @mokom
    you should try the book "building django 2.0 web applications"
    it's very detailed and touches on alot of concepts
    Falgun Swami
    @swamifalgun
    i need some help building an api with django
    can anyone help me out
    Falgun Swami
    @swamifalgun
    @mariocesar
    Shay Tessler
    @shacoshe
    Hello Django community, I created a new response object based on StreamingHttpResponse for bundling, streaming React, etc.. and more easily
    https://github.com/shacoshe/bigpipe-response
    I am still thinking of a logo any ideas?
    NikiSchlifke
    @NikiSchlifke
    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...
    NikiSchlifke
    @NikiSchlifke
    Something tells me that a 100,000 row long table can't be good, right?
    AlbertDavid
    @AlbertDavid94
    @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
    RunTimeTerror
    @IAmAMissingColon
    How can I add my custom themes in Django ?
    anyone ?
    NikiSchlifke
    @NikiSchlifke
    @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.
    I have considered using mongodb and I still might migrate to it later but I don't want to pass up on a django admin that "just works" for now.
    NikiSchlifke
    @NikiSchlifke
    Essentially normalized database == slow orm queries every time, so I'm looking to start out with a reasonably denormalized db from the start to save me from refactoring later.
    matrixbot
    @matrixbot
    Ajira what do you mean by custom theme ?
    NikiSchlifke
    @NikiSchlifke
    @IAmAMissingColon Django is not something where themes apply, but there might be higher level application specific frameworks based on django where you can.
    For instance django-cms, etc...
    In a sense everything is "custom" if you're using just django.