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
Pruthvi
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
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
niwla23
thanks @IronHulk007
Shekhar
welcome
أمجد☄
How can i display a method created in a queryset with annotate in the admin panel ?
أمجد☄
Mirco
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.
godmode
Any idea for my problem?
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...
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...
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...
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
godmode
request.Post.get('whatever') not with []
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..
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
🎄Pooh
Sorry for my russian :) I mixed up chats 😂
Link
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
N S
I have two modelforms on submit i want to redirect to another modelform how can i achieve this