Mirco
Mirco
dhelbegor
Thanks, i'll try
dhelbegor
I just need to know if the context is in queryset
Mirco
If u still have problems, share your code with pastebin and we can help you better
Isaías
Good morning. I'm using the library widget_tweaks on my forms. In django admin I upload a pdf file successfully. But when I do the same process in the form it does not work. Code: ( {% render_field form.anexo class="form-control" %} ) Help.
Anonymous
is it possible to send 3 querysets using class-based views? I remember trying to use get_query_set once to return 3 queryset variables, but it did not work
Rajjix
if ur searching one model u can chain filters
Rajjix
also check out how to use the Qobject
Rajjix
here's an example
https://micropyramid.com/blog/querying-with-django-q-objects/
Mirco
Anonymous
I do not want merge querysets, I want to return 3 list of different objects: all_posts, all_tags and top_posts
Rajjix
try data[‘all_tags’] = self.all_tags 🤔
Anonymous
holy
Anonymous
consequences of sleep
Rajjix
i eould prefer defining the query right away instead of putting it up there
George
hi, i made a migration i added a field to my table, it went read_only and i don't understand why
Rajjix
Anonymous
is not working
George
well, im not used to psql command line i was trying.
Im using dbeaver and the schema was not updated :/
Rajjix
can u access psql?
Anonymous
https://pastebin.com/Cxzsmtpy
Anonymous
the list of posts is ok. But the other two do not
Rajjix
can u access psql?
I will send you the update command if you can connect to your db
Anonymous
nothing appears on the page, everything is ready to iterate the querysets.
Rajjix
George
George
the schema is not updated :/
Anonymous
George
George
ok in the query i made , the new column appears
George
im using postgresql
Rajjix
this is really strange, but is this your first migration update? maybe user alter permission or something ? just throwing some guesses
Anonymous
now everything is working perfectly, still missing some more views ... I had seen everything about class based on the topic of documentation, but I did not implement because I could not solve some things, now I'm trying everything again until I can.
George
Anonymous
see before and after
https://pastebin.com/LDanZV1S
Rajjix
Like this is a far fetch but first your sql throws a create command with the column names and after that, it start alter table commands when you add new fields if you know what i mean, i just had similar issues a while ago and that was the reason
Anonymous
still decreases lines by changing queryset by model = Post
George
@Rajjix this is stupid
George
the schema doesn't update in dbeaver
George
now i did it manually
Rajjix
Nvm
Rajjix
Anonymous
Hi can anyone which database is suitable for fetching and storing images frequently, also it should also support other data types and can be implemented in Django
Yashendra
Hey guys getting following errors on running server☝️
Yashendra
Somebody please look into it.
Raven
Hi Django friends, only quick question, I have mp4 file hosted on foreign server, is it possible to offer download dialog to user despite of I don’t host that file?
Thank you in advance.
Anonymous
What am I doing wrong here? before everything was ok and now is no longer working. I was counting all posts in the template with {{posts.objects.all.count}} and is now no longer returning the total number of posts. I can only use | lenght to count but only returns the current posts of the page.
Anonymous
in my views:
model = Post
paginate_by = 2
context_object_name = 'posts'
Anders (izzno / gooood) 🇳🇴
Can someone have a look at this for me:
https://www.django-rest-framework.org/api-guide/filtering/#api-guide
Look at the code example over (the text):
"http://example.com/api/products?category=clothing&in_stock=True" <— dummy (on the page link over !)
A link like this would meen that in the field "category"' the PK would be clothing? In my case i have a foreign key in my "?my_field=foreign_key_id" which is the PK of my foreign key?
This is how i got this to work I just want to understand.
btw, my serializer is nested, could that be the difference
My point: My link = '?type=5&child_category=3' not 'installprices/?type=sometext&child_category=sometext'
Am i getting this right ?
R
Raven
@Roger thank you for answer I go to do find out more, thank you 🙂
R
R
Anonymous
Hi, how can I update what shows in a field in django admin according to the previous field?
For example:
If I click in X in field 1, it will show W, Y, Z in field 2
If I click in P in field 1, it will show Q, R, S in field 2
Anders (izzno / gooood) 🇳🇴
R
R
Anonymous
R
not work
Should, unless it has been changed in new versions which I dont think is the case, but as an alternative just do the count in the view and pass its value as context
Anders (izzno / gooood) 🇳🇴
Rajjix
In your ciew function why are you passing a second parameter for page, remove the 1 and let page be captured from your get request, and then at the bottom posts = paginator.get_page(page)
Anonymous
The count problem still persists, but when I pass it through get_context_data, it works normally ... But then paging and stuff stop working.
Basically my blog views are complete for now, any refactoring tip or anything?
https://pastebin.com/7yWn2vLa
Note: I use tags in all views because I want to display all the tags in the dropdown that stays in the blog base file, so in any view I need to iterate over all tags. I thought it better to do this than to type all tags in html.
R
ⓦⓐⓢⓓⓚⓘⓛⓛⓔⓡ
Hello guys, I don't know anything about Django. But have an idea about python. I want to learn Django from beginning, please provide some basic course or tutorial to touch the concept of Django. Thank you. 🙂🙂🙂
Anonymous
George
hi ,im modifying some shit in the django admin
but __init__ doesn't execute :(
#admin.py
class SolarPlantForm(forms.ModelForm):
foo_field = forms.CharField(max_length=20,required=False)
class Meta:
model = PowerPlant
fields = ['__all__', 'foo_field']
def __init__(self, *args, **kwargs):
print("hey")
class PowerPlantAdmin(admin.ModelAdmin):
model = PowerPlant
form = SolarPlantForm
admin.site.register(PowerPlant, PowerPlantAdmin)
Anonymous
Hi Anybody can suggest the top companies who is doing code review and secuirty auditing for web applications (Django and Nodejs based projects)
ⓦⓐⓢⓓⓚⓘⓛⓛⓔⓡ
Anonymous
R
George
Anders (izzno / gooood) 🇳🇴
Meta Warning:
I am curently working on a project with a php developer. He makes the front end and I make the API. I've been thinking to learn another language for a while now and was wondering if you think this is a good combination. So far I have not really seen anything in the frontend you can not do with python.
Id like to hear from someone with experience from both worlds.
⟨ Simon |
Anders (izzno / gooood) 🇳🇴