First step is import Comment and ContentType to your view like below from django.contrib.comments.models import Comment from django.contrib.contenttypes.models import ContentType Second step is defining your model which you want to paginate its comments content_type_id= ContentType.objects.get_for_model( YOUR_MODEL_NAME ) Last get comments of specific instance of your model class with defining object_pk as filter parameter comments = Comment.objects.filter(content_type=content_type_id,object_pk=quote_id) here is complete view code from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.contrib.comments.models import Comment from django.contrib.contenttypes.models import ContentType def quote_show_page(request,quote_id): quote = get_object_or_404(Quote, id=quote_id) content_type_id=ContentType.objects.get_for_model(Quote) comments = Comment.objects.filter(content_type=content_type_id,object_pk=quote_id) paginator = Paginator(comments, 5) # Show 5 comments pe...
Containers A container is a process running on the host system. This process is started by the container runtime from a container image, and the runtime provides a set of tools to manage the container process. Namespaces virtualize the container process’s PID, network, root, and users. Cgroups help set resource usage limits the container process can consume on the host system, and security contexts enforce permissions the container process has on the host system. A container, as a runtime object, consumes the typical resources any running process would consume on a system: storage for the file system and any saved configuration files, CPU, memory, and networking to serve traffic to/from external clients, and other containers or devices on the system. docker run container from image and connect it with shell , install necessary networking tools docker run -d -it ubuntu:22.10 bash docker run -d -it --privileged ubuntu:22.10 bash -> if you need to write to...
pi@raspberrypi : ~ $ more stream_working.sh raspivid -t 0 -w 1280 -h 720 -fps 30 -vf -b 1700000 -o - | tee YOURFILENAME.h264 | gst-launch-1.0 -v fdsrc ! h264parse config-interval=1 ! rtph264pay ! udpsink host = TARGET_IP(here is my macbook) port= 9000 sertac-MacBook-Air:~ sertac$ more get_stream_working.sh gst-launch-1.0 udpsrc port=9000 ! application/x-rtp,encoding- name=H264,payload=96 ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink here above you can find gstreamer commands to stream live HD video from raspberry pi and save it file at the same time it is working on pi3 almost no latency but pi zero could not be fast enough for this process I saw at least 45 seconds delay
Comments