Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 14 16:11
    @MadLittleMods banned @Rehmanjeff
AlbertDavid
@AlbertDavid94
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
@shay-te
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
DaffyDuck
@DaffyTheDuck
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.
AlbertDavid
@AlbertDavid94
@NikiSchlifke yes, a documentoriented database could be the best solution for this
DaffyDuck
@DaffyTheDuck

@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.

Oh! Okay :smile:

AlbertDavid
@AlbertDavid94
@IAmAMissingColon Django is just a backend framework for web-applications. If you're familiar with frontend development, you might want to look at bootstrap as a predefined "theme"
There are derived versions of it all over the web (https://bootswatch.com/)
Hedrick Godson
@ShedrackGodson
Welcome
DaffyDuck
@DaffyTheDuck
Sure! Thanks for help :smile: @AlbertDavid94 @NikiSchlifke
Bo
@BoPeng
I need to write some complex forms that for example allow a user to update information on his book, and invite collaborators to reviewer it, so a single "form" with a "submit" button does not seem to cut it. Are there any general advices on such use cases? Right now I am thinking of a webpage with multiple JS functions to update book information, without a big submit button. Then I cannot seem to make use of any form/view features of django.
NikiSchlifke
@NikiSchlifke
@BoPeng Well there's the django-rest-framework way along with a frontend framework like React.
But you could also do it the old fashioned way and just use the rest api where you really need it and oh well jQuery still exists.
If you don't want to do that you can always use multiple forms on one view and make sure existing info is pre-filled properly.
Bo
@BoPeng
Thanks. I have decided early on to use "pure django" and do not venture into areas that I do not know (REST, graphQL, reactJS etc), but I guess it is time to learn something new anyway. My biggest problem is that the rest of the website is already template based with sprinkles of JS+Jquery so the final product would be ugly in terms of use of technologies.
Bo
@BoPeng
BTW, I have not decided on the implementation of "role", "subscription" etc for the ManyToMany relationship between User and Group yet. It seems pretty tricky to extend the GroupManager according to this stack overflow post, but django-organizations is unstable now (2.x alpha) and I do not like the fact that it does not use the built-in Group and Permission facilities. django-groups-manager uses Group but appears to sync its models to User and Group and there are concerns on redundancy and performance. In general I dislike having an unused group field in User and would prefer extending it instead of using a third-party solution...
NikiSchlifke
@NikiSchlifke
I have a question regarding django-rest-framework:
What's the best practice of creating model instances with a foreign key to an existing instance with validation?
I've tried adding it to extra_kwargs in my serializer and passing it to serializer.save(my_foreign_key_id=serializer.validated_data['my_foreign_key']) in the viewset.
If I am at the right track: How do I get it into serializer.validated_data['my_foreign_key']?
If not how do you guys deal with this use case?
NikiSchlifke
@NikiSchlifke
I was sort of expecting that there's a foreign key validator already, but I can't find one so I suspect I'd have to use a custom validator for this.
But then why? I can't think of any concrete rest api that doesn't require some reference to existing data.
NikiSchlifke
@NikiSchlifke
I sort of figured it out, the problem was I was trying to include related data in my ListCreateAPIView which isn't a good idea anyway.
But I do want to include related data in the instance endpoint. So from what I gather I need two serializers for this model or overload something inside the serializer.
NikiSchlifke
@NikiSchlifke
Essentially I want a serializer that uses the foreign key itself overall but use nested data for retrieve.
Gautam
@gautam1858
Made this full stack webscrapper for ML, please star the GitHub repo if you like and give your inputs on the same https://github.com/gautam1858/FullStack-webscraper-for-ML
azarshab-saeed
@azarshab-saeed
How cab I bypass login page in django proxy server??
Mitai
@MitaiGit
Hi everyone I'm a novice noob, sorry for my stupid question, I get json of the form [{"id":1,"name":"Windstorm"}, {"id":2,"name":"Bombasto"}, {"id":3,"name":"Magneta"}, {"id":4,"name":"Tornado"}]
how can I make it generated this way? { "data": [ { "id": "1", "name": "Windstorm" }, { "id": "2", "name": "Bombasto" }, { "id": "3", "name": "Magneta" }, { "id": "4", "name": "Tornado" } ] }
it is need for angulardart tutorial https://angulardart.dev/guide/server-communication
matrixbot
@matrixbot
Ajira myvar = {"data": yourjsondata}
something like this ?
AlbertDavid
@AlbertDavid94
@azarshab-saeed what exactly do you mean with bypassing a login page?
Daniel Nordberg
@dnordberg

Hi, I'm trying to upgrade from Django 1.4.6 to 2.2.9, I use multi-table inheritance in one of my apps and its causing an error, specifically "django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet" the stack trace starting with:

File "/code/media/models.py", line 285, in <module>
class Album(MusicUpload):

I've searched for this error specific to model inheritance to no avail. Has anyone seen something like this? I'm running this through './manage.py check' to identify issues

Daniel Nordberg
@dnordberg
@gautam1858 Could you explain what the project does that a scrapy + some ml doesn't? If a front-end is provided could you provide screenshots and more usage information
Mitai
@MitaiGit
@matrixbot {"data": [{"id": "1", "name": "Windstorm"}, {"id": "2", "name": "Bombasto"}, {"id": "3" , "name": "Magneta"}, {"id": "4", "name": "Tornado"}]} -- like that