Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Ahmed Sallam Nassar Awad
    Hi, everyone, How can I make query string in django like
    Filip Lav Maksimovic
    @ahmed-sallam can you elaborate more on that?
    Ahmed Sallam Nassar Awad
    Thanks @maximlion , I mean , I want to make a query string in urls with key=value
    Filip Lav Maksimovic
    Hello everyone, is there a way I could add an attribute to all query objects using annotate? I basically just need to get a value from an m2m relationship of the object and save it as an attribute of the object.
    Something like this: query.annotate(value_to_be_added=("value_from_m2m"))
    @ahmed-sallam first you need to adapt your to accept a url parameter, then adapt the views get method to accept parameters and that should be it. This could help:
    Ahmed Sallam Nassar Awad
    @maximlion Thanks a lot, I will try it.
    Swaraj Pande
    Hey guys, new to django here :)
    Hey guys. SOS please. How do I write a URL pattern for a URL like this? weather/?current_location=-33.927407,18.415747&booking_location=-32.927407,19.415747
    When I do reverse(‘weather’, kwargs={‘current_location’: some_value, 'booking_ location’: another_value}) I am getting a NoReverseMatch exception.
    @swarajpande4 Welcome to the world :0
    @dubesoftware Too short. I need more detail on your question
    I need you see your and
    national_card = models.ImageField(upload_to='./national_cards/', null=True, blank=True)
    How can I add encryption key to encrypt my national_card?
    And frontend will decrypt it by itself
    hardik Gajjar
    Implement your custom storage class for your encryption
    Thank you
    Brian Edelman

    I am using Django Rest Framework and have a model with a timestamp field that I want to group by. The outcome I would like is to have something like {tournament_count: 2, start_date: datetime object, tournaments: [{...tournaments model representations}]} I currently have a queryset returning the tournament_count and start_date but now I want to drop in the actual tournaments as well.

                    start_date=Trunc("time_stamp", "day", output_field=DateTimeField())

    I can't figure out a solution that will work well and scale well. Any thoughts?

    I am using django email message class ,and getting the above error ,any help is highly appreciated
    Just figured out the problem in case someone has read it. The system uses [ user_id, user_name ] as choices, not [ User instance, user_name ].
    James Komo

    Hello people, has anyone here managed to create user profiles while using Django allauth for authentication. I am having challenges with user has no profile errors and RelatedObjectDoesNotExist a yet I have a Profile model with OnetoOne relationship with User model and a profile view plus use of Django signals for profile creation and saving



    from django.shortcuts import render, redirect
    from django.contrib import messages
    from django.contrib.auth.decorators import login_required
    from .forms import ProfileUpdateForm

    def profile(request):
    if request.method == 'POST':
    p_form = ProfileUpdateForm(request.POST,
    if p_form.is_valid():
    messages.success(request, f'Your account has been updated!')
    return redirect('profile')

        p_form = ProfileUpdateForm(instance=request.user.profile)
    context = {
        'p_form': p_form
    return render(request, 'profile.html', context)


    class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    image = models.ImageField(default='default.jpg', upload_to='profile_pics')
    role = models.CharField(max_length=25,choices=role, default='Freelancer')

    def __str__(self):
        return f'{self.user.username} Profile'


    @receiver(post_save, sender=settings.AUTH_USER_MODEL)
    def create_profile(sender, instance, created, **kwargs):
    if created:

    @receiver(post_save, sender=User)
    def save_profile(sender, instance, **kwargs):


    @jameskomo From my experience I recommend thick Form or Serializer, but not implement signal
    Help I have a question
    ORM question
    Falgun Swami
    Hi i need some help regarding django.
    So i have a file which loads a json file. I want to be able to configure this database file as a database in my django app. I have tried to find ways to do it but failed. Any help will be appreciated. Thanks
    James Komo

    Does anyone know how to query another model based on Foreign Key? Say I have a Project model that is a FK in task model and I want to generate all the task_names by querying the Task model and only see tasks applicable to a specific project?

    Tried doing this and it is not working project_tasks=Task.objects.filter(project_id__in=Project.objects.all()).order_by('latest_submission_time')

    hey, i have question about django admin can someone help me
    how can i export a user to pdf
    @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)