So I've got this SQL query running against postgres but the django interface requires a queryset instance. Would Model.objects.raw(SQL) return a queryset?
though really just sounds like you need a table with a user and message field. User being the one that it's for. If you wanted to track the sender secretly you could as well. Not sure if you need all the mechanics of a messaging app
eccentric_j
Nope, looks like I was wrong. Returning a RawQueryset from within a admin.SimpleListFilter's queryset method is returning an error
agrawalritesh joined the channel
agrawalritesh has quit
chasonchaffin joined the channel
iiie has quit
amcorreia joined the channel
iiie joined the channel
adlpaf has quit
adsworth joined the channel
raposinha has quit
raposinha joined the channel
adlpaf joined the channel
morenoh149
moldy: have you used drf swagger? I wonder if it can fetch a token and then perform authenticated requests
theo_moore joined the channel
DodgeThis joined the channel
bkxd joined the channel
tdy joined the channel
Kipe_
morenoh149: I would suggest looking into drf-yasg
hanetzer
how would one do 'KEY username (username),' properly in django? I'm doing that radius app I mentioned earlier
Kangermu has quit
mintograde joined the channel
morenoh149
hanetzer: is that sql?
hanetzer
morenoh149: yeah. I'm translating schema.sql to models, doing pretty well so far
tdy has quit
morenoh149
well key is what like a foreign key or primary key right
hanetzer
morenoh149: unsure. would you like to see schema.sql ?
morenoh149
sure
but you want to make django models from an existing schema?
my primary key is called ID. When submitting a model formset Im getting {'id': ['This field is required.']}].... In my template I have <td> {{ form.instance.pk }}</td>
eccentric_j
If it helps a more natural explanation would be "I want to filter OnboardingVenues who were created by users that belong to a company that have one or more merchants."
jessamynsmith
eccentric_j: thanks!
I'm just making a sample app now so I can test
morenoh149
hanetzer: got nothing in Learning SQL
sydbarret has quit
techalchemy has quit
hanetzer
anywho, dl'ing a daloradius appliance to have something to compare to/build from
chasonchaffin joined the channel
Lcstyle has quit
Lcstyle joined the channel
cmgurba has quit
jessamynsmith
eccentric_j: how do users get attached to companies?
hanetzer
jessamynsmith: money can be exchanged for goods and services
jessamynsmith
hanetzer: lol
eccentric_j
jessamynsmith: It's the default behavior of django groups I think but there's an account_user_groups table with group id and user_id
jessamynsmith
eccentric_j: hm, maybe that got lost in translation...
let me see...
eccentric_j
Ah sorry, they're referenced in the SQL and I tried to mention it in the models sample.
jessamynsmith
it might be that I don't have the full setup to see what you see
I should be able to fake something
eccentric_j
Oh hmm I'll look at the source of the django auth Group\User models to see if they define the model to relate them
jessamynsmith
eccentric_j: so normaly you can add users to groups from the admin, but I hadn't done a custom admin for User so it wasn't there
chasonchaffin has quit
eccentric_j
Oh I see
audioburn joined the channel
Something is creating the association behind the scenes because `user.company` does return the company instance or None
jessamynsmith
yeah, I think I'll be able to add them once I get this custom admini working