Naveen
can you explain it
Pruthvi
FileNotFoundError: [Errno 2] No such file or directory: Iam new to django iam getting this error....please give me solution to this
Pruthvi
If I run server getting this error
Govind
How to upload djongo website to .ac.in
Naveen
How to upload djongo website to .ac.in
google - ways to host a django website
Naveen
the cmd where you are running "python manage.py runserver" should be in the current directory. If you still have problems send ss and code .
niwla23
I can only access from localhost :(
Anyone knows? I'm confused
godmode
hi, how's it going! I got a problem with a search formulary and i can't get why is not working on, it's seems it's not entering to the view ... this is all my code with the important parts https://pastebin.com/YaW80E2z
godmode
Any idea, i guess the problem should be in the action of the form search but is pretty weird cuz if it's redirecting to the url why the view is not executating...
godmode
Another weird thing is that i get all necessary objects to the page less posts.... so it's not doing anything...
godmode
[20/Jul/2019 20:19:05] "GET /results/?q=Lorem HTTP/1.1" 200 17545
godmode
this is what the tracker says
Shekhar
http://192.168.178.49:8000/
./manage.py runserver 192.168.178.49:8000
niwla23
thanks @IronHulk007
Shekhar
welcome
أمجد☄
How can i display a method created in a queryset with annotate in the admin panel ?
أمجد☄
أمجد☄
In admin panel but where ?
In the specific model where the method is in
Shekhar
override the admin template 😁
أمجد☄
For example am having a method where am declaring a queryset with a objects.filter, and i want this to be displayed in the admin panel where the model is.
أمجد☄
override the admin template 😁
Nope i dont want to change the template
godmode
Any idea for my problem?
أمجد☄
Nope i dont want to change the template
I just want to add data to that specific model
أمجد☄
override the admin template 😁
Oh so you were not talking with me 😅
godmode
The object.method()?
أمجد☄
The object.method()?
I mean a function that have a queryset of objects filtered out of that model
godmode
I need the Code
godmode
Ain't get it
godmode
A view with a .filter()
أمجد☄
K
godmode
Making a for and doing the metjod each object if the queryset...
أمجد☄
Making a for and doing the metjod each object if the queryset...
Its in models.py not a view so i dont think that this would work
godmode
Maybe like my Colment section , It got a method isaproved()
godmode
Where os supposed you want yo use the method?
godmode
ain't get it without the Code...
أمجد☄
Where os supposed you want yo use the method?
Well its an annotate not a filter but if i knew how to view the objects of a filter i woulf know how to view an annotate since both of them are in a queryset of objects
godmode
Objects = Model.objects.all()
godmode
for object in objects:
أمجد☄
class ExpiredManager(models.Manager): def get_queryset(self): return super().get_queryset().annotate( expired=ExpressionWrapper(Q(valid_to__lt=Now()), output_field=BooleanField()) ) class ProductKey(models.Model): product = models.ForeignKey(Product, on_delete=models.CASCADE, unique=False) key = models.CharField(max_length=14) valid_from = models.DateTimeField(default=timezone.now) valid_to = models.DateTimeField() objects = ExpiredManager()
godmode
object.method()
أمجد☄
Wait am gonna paste it into pastebin its gonna look much better
godmode
Paste it un pastebin...
أمجد☄
Paste it un pastebin...
Mutual thinking 😅
godmode
Yeah , i just use to paste the important parts
أمجد☄
https://pastebin.com/VvqJTNYn
godmode
And you want to use the method ?
Abhishek
https://codeshare.io/5Nkyp1
godmode
Yeah it's pretty weird
godmode
You can get the query set un the same view using the queryset methods from Django
godmode
I don't know why you got a method for that
أمجد☄
You can get the query set un the same view using the queryset methods from Django
But i dont want to view it to the public, i just want to use it for the admin panel
godmode
request.Post.get('whatever') not with []
godmode
But i dont want to view it to the public, i just want to use it for the admin panel
I'm not and expert but there is an admin.py where you can make methods and things just for the admin
Muflone
AdminModel
Muflone
You may add read only fields
Muflone
Add a new class that extends ModelAdmin and add the members to the read_only list
Muflone
There is a good reference on agiliq website about Django admin
أمجد☄
Okay i will do some research
godmode
hi, how do you {% set i = 0 %} in django?
Muflone
you don't
Muflone
at the max you can create a new custom filter
Dhave
I really like django... Django doesnt like me..
Anonymous
I really like django... Django doesnt like me..
Try to to give django more beautiful gifts to make it like you
Nitesh
on value must be either True or False
Nitesh
I'm getting this error while submitting my form with Booleanfields
Link
Which is the best e-commerce framework compatible with django?
Mirco
Which is the best e-commerce framework compatible with django?
Saleor is a good one ( not a framework btw )
🎄Pooh
Sorry for my russian :) I mixed up chats 😂
Nitesh
I'm using this for booking tickets for a movie
Nitesh
def book_ticket(request, pk): if request.method == 'POST': form = TicketForm(request.POST) if form.is_valid(): user_id = request.user.id ticket = form.save(commit=False) ticket.save() return redirect('movies') else: form = TicketForm() return render(request, 'movies/tickets.html', {'form': form})
Nitesh
how i can send user_id to insert into db
Mirco
Can I DM you?
What do you need ?
Arulmurugan
how i can send user_id to insert into db
Does your ticket model have a field named user?
N S
I have two modelforms on submit i want to redirect to another modelform how can i achieve this