Django Model Properties & Methods | @property decorator | get_absolute_url() method

Поділитися
Вставка
  • Опубліковано 4 гру 2024

КОМЕНТАРІ • 58

  • @bugbytes3923
    @bugbytes3923  7 місяців тому +1

    ORM Playlist link: ua-cam.com/video/EsBqIZmR2Uc/v-deo.html

  • @amine63404
    @amine63404 7 місяців тому +9

    I like before I Watch. Please more django content. Thank you for all the great content.

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +1

      Thanks a lot, much appreciated! It'll be a lot of Django in the next month ;)

    • @amine63404
      @amine63404 7 місяців тому

      @bugbytes3923 That's great, we already learned a lot from you.
      Perhaps you could make a kind of complete course about django with begginer, intermediate and advanced level.
      I am sure knowing the quality of your job that many people (me included) will be ready to pay for it.

  • @peterholzer98
    @peterholzer98 7 місяців тому +5

    Thanks a lot and YES please make a video about model managers.

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +2

      Will do, thanks a lot Peter!

  • @adkocol
    @adkocol 7 місяців тому +2

    great content, well explained... more django practical hints please :)

  • @developershub2024
    @developershub2024 7 місяців тому +1

    A great content, thank you so much!

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +1

      Thanks a lot, much appreciated!

    • @developershub2024
      @developershub2024 7 місяців тому

      @@bugbytes3923 Hello, can you please do a video on hxhtml2pdf, PLEASE, because there is a function provided in the documenention about how to Convert HTML URIs to absolute system paths so xhtml2pdf can access those
      resources, it returns an error, i have tried to find the problem but i havent got the solution, I HOPE YOU WILL CONSIDER THIS!!!!

  • @dmitrymikhailovnicepianomu8688
    @dmitrymikhailovnicepianomu8688 7 місяців тому +2

    Great as usual.

  • @Yarkanlaki
    @Yarkanlaki 7 місяців тому +2

    I came here after 4h coding Django ❤

  • @hack727
    @hack727 7 місяців тому +1

    i love your content, please make videos on custom user model, groups and permission and django signals.

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +1

      Great suggestions, thanks! Will try and prepare soon.

  • @_esplor
    @_esplor 7 місяців тому +2

    Would love to see some processing of data before saving to database/disk.
    I have a model with filefield for uploading gpx files. I want to save the original file, but also extract metadata into different fields of the model.
    For example number of points for the track, elevation of each point, calculate the length of the track...
    I appreciate your django/python content very much. And I hope you will be doing more with django gis, and hopefully "djangorestframework-gis".

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +1

      Thanks a lot! There will be lots of GIS stuff on this channel in the future, with GeoDjango too - a big part of my working background is in GIS. I'll need to set some time aside to prepare it though, probably over the summer.
      Are there any GPX file examples that you could point me to for a video like this? I'd be happy to try a small video on this in the near future.
      Thanks again for the kind words, much appreciated!

    • @_esplor
      @_esplor 7 місяців тому

      @@bugbytes3923 Nice! Much appreciated, let the countdown begin :)
      I'm a noob in GeoDjango/GIS, even building up models and deciding where to store the data was a struggle.
      My goal is to setup GeoDjango+rest as a backend for serving hiking tracks and hiking related pois (parking, viewpoints, shelter, fresh water).
      Maybe using Nextjs as frontend. I know this is a hairy goal for me, but man I'm learning a lot!
      Let me prepare a gh repo to share. Is it OK for you I make a private GH repo where I can invite you to join?

  • @anouarben779
    @anouarben779 7 місяців тому

    some django content again, thank you !

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +2

      Thanks! The next month will be full of Django ;)

  • @seydinaoumarsamabaly1806
    @seydinaoumarsamabaly1806 7 місяців тому

    Very great content !

  • @leboyoyo
    @leboyoyo 7 місяців тому +1

    Thank you so much for all this useful content!!! Could you please tell me where you're from? I've been following your videos for over a year now, and this accent is starting to drive me crazy!

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +3

      Thank you for the support! The accent is from Glasgow, Scotland!

    • @leboyoyo
      @leboyoyo 7 місяців тому

      @@bugbytes3923 thanks for the reply :)

  • @edmfestivals6066
    @edmfestivals6066 7 місяців тому

    NO idea what your doing but I love your Scottish accent

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +1

      Haha glad you like the accent!

  • @Gbolly_bambam
    @Gbolly_bambam 7 місяців тому

    nice content🤯

  • @frameff9073
    @frameff9073 7 місяців тому +2

    good thank you

  • @juanbetancourt5106
    @juanbetancourt5106 7 місяців тому

    Thank you

  • @kunaltakalkar6647
    @kunaltakalkar6647 7 місяців тому

    Thank you for django videos.
    Can you create a video how to perform each type of sql joins in django...I would be great help

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +2

      Thanks! Great suggestion, will add it to the list.

  • @dmitrymikhailovnicepianomu8688
    @dmitrymikhailovnicepianomu8688 7 місяців тому +1

    Can you create video about docker + django? And maybe then deploying a project to Ubuntu. Not on heroku or netlify but to classical clean Ubuntu server. That would be very interesting.

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +1

      Great suggestion! I've got plans for deployment videos, and deploying to an Ubuntu instance would definitely be interesting. I'll see what I can do soon!

  • @aashayamballi
    @aashayamballi 7 місяців тому

    thank you

  • @rns10
    @rns10 7 місяців тому

    Hi
    thanks for this, I have been following this series for quite some time.
    I would like to know if you plan to also push the code to github.

    • @bugbytes3923
      @bugbytes3923  7 місяців тому

      Thanks! I could put the final models.py file on there, if that would be helpful?

    • @rns10
      @rns10 7 місяців тому

      @@bugbytes3923 Thanks for replying back. Yes that would suffice the need. Thank you.

  • @ntwarioscar
    @ntwarioscar 7 місяців тому +1

    thanks for your videos but I want to ask you there's video you have done about notification with channels and websocket is it possible to do notofication with django by using htmx, alpine, hyperscript with wsgi or it is not possible?
    please tell me

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +1

      I would recommend ASGI + django-channels for this, if possible. Or some other WebSocket package.
      With WSGI, it is definitely possible, I would think - but I've no experience with that, to be honest.

  • @piorprogramadorbr9481
    @piorprogramadorbr9481 7 місяців тому

    am trying to figure it out, i have a rural and a urban properties, how do i build my models? should i create a models for each of than and them apply a foreing key to a listing models ?

  • @kushalpy
    @kushalpy 7 місяців тому

    Could you make a latest way on like setting up social logins like with google and facebook using DRF. Many libraries are being broked.

    • @bugbytes3923
      @bugbytes3923  7 місяців тому

      Good suggestion! Will add it to the list.

  • @anouarben779
    @anouarben779 7 місяців тому

    I have a question regarding database management, what is the best way to create database tables for multiple clients (small businesses), is creating a business model enough to separate the databases between them or is there a better practical way ?

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +1

      I'd recommend a package like django-tenants for separation of tables for each client. This basically works by using a single database, but creating multiple schemas within the database - one per client. Each client can therefore have the same tables, but separated into their own schema.
      pypi.org/project/django-tenants/
      Would a video on this be useful?

    • @anouarben779
      @anouarben779 7 місяців тому

      @@bugbytes3923 thanks for the reply, it sure will be helpful thank you again I appreciate the effort

  • @SapereAude1490
    @SapereAude1490 7 місяців тому

    I never knew about the @property decorator in models - if I were using FastAPI as a microservice and SQLAlchemy, could I do the same? Is it inadvisable to have more complicated methods as @property?
    Also, for some reason, your accent makes me pay attention better.

    • @bugbytes3923
      @bugbytes3923  7 місяців тому

      Thanks! Yes - properties are something provided by Python classes, so they can also be used with SQLAlchemy in exactly the same manner.
      I would advise against doing anything too complicated in a property, particularly if it involves reaching beyond the model class for external dependencies or performing additional SQL queries, etc. For simple stuff, it's perfect though.

  • @Yarkanlaki
    @Yarkanlaki 7 місяців тому

    My problem is I can use property for indexing and filtering

  • @developershub2024
    @developershub2024 7 місяців тому

    Hello @bugbytes3923, can you please do a video on hxhtml2pdf, PLEASE, because there is a function provided in the documenention about how to Convert HTML URIs to absolute system paths so xhtml2pdf can access those
    resources, it returns an error, i have tried to find the problem but i havent got the solution, I HOPE YOU WILL CONSIDER THIS!!!!

  • @myoji5580
    @myoji5580 7 місяців тому +1

    Problem
    CharField need blank=True, null=False
    Because db have two value ‘’, None
    Confuse read db
    Restaurant.objects.filter(nickname=‘’) or Restaurant.objects.filter(nickname_isnull=True)

    • @bugbytes3923
      @bugbytes3923  7 місяців тому +1

      The solution for a CharField would be to disallow Null values, and make the default an empty string.

    • @DhavalAhir10
      @DhavalAhir10 7 місяців тому

      Even though it is a CharField, I prefer to set NULL values on the database side.
      CharField(null=True)
      Storing a blank string still constitutes a value, whereas NULL itself signifies the absence of a value. If you store blanks in the database for a CharField where there should be no value, you will end up with various types of empty strings:
      (i) ""
      (ii) " "
      (iii) " "
      (iv) " "
      (v) " "
      It's better to use null=True even with CharField type of field.
      When you use Django's save method or objects.create()
      , it checks for values in this sequence for any absent field :
      First priority: Use the default value if provided in the model field.
      Second priority: Use NULL if null=True is provided in the model field.
      Third priority: Use an empty blank string (irrespective of whether blank=True is provided or not), because you can't prevent Django from storing nothing on the database side. Django is frustrated now.