Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Authintication upload files using Django
hello I have two difference projects one project have only authentication and other have only fileupload and upload to personal folder per user(work fine from admin mode)and I want to connect with one project. On the second project I have create a fuction where create new personal folder for any user where want upload files using user_id,user_username (I have to many similars ways to do this function and this is for test). that I don't know is how to take user_id or user_name of login user and how to use this in views.py to my fuction for generate_path. I thing so maybe like this user = Photo.objects.get(user__id=user_id)but I am not sure def generate_path(user): return "/{0}/img".format(user.username) class Photo(models.Model): user = models.ForeignKey(to=settings.AUTH_USER_MODEL) file = models.FileField(upload_to=upload_to=generate_path(self.user))) views.py @login_required class BasicUploadView(View): def get(self, request): photoslist = Photo.objects.all() return render(self.request, 'index.html', {'photos': photoslist}) def post(self, request): form = PhotoForm(self.request.POST, self.request.FILES) if form.is_valid(): photo = form.save() data = {'is_valid': True, 'name': photo.file.name, 'url': photo.file.url} else: data = {'is_valid': False} return JsonResponse(data) -
Using django generic views
I am getting an error using the deleteview while create and update view are working fine. My codes are:- Views.py- from django.views import generic from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.core.urlresolvers import reverse_lazy from .models import Album class AlbumDelete(DeleteView): model = Album success_url = reverse_lazy('music:index') urls.py- url(r'^album/(?P<pk>[0-9]+)/delete/$', views.AlbumDelete.as_view(), name='album-delete'), music/index.html - `<a href="{% url 'music:album-delete' album.id %}"><span class="glyphicon glyphicon-trash"></span></a>` Error is TemplateDoesNotExist at /polls/album/2/delete/ polls/album_confirm_delete.html -
Python SSH Exception: incomatibility, can someone fix it
connection = netmiko.ConnectHandler(ip = '10.10.10.1', device_type='cisco_ios', username='sudd', password='anni') Traceback (most recent call last): File "", line 1, in File "build/bdist.linux-x86_64/egg/netmiko/ssh_dispatcher.py", line 120, in ConnectHandler File "build/bdist.linux-x86_64/egg/netmiko/base_connection.py", line 142, in init File "build/bdist.linux-x86_64/egg/netmiko/base_connection.py", line 492, in establish_connection File "/usr/local/lib/python2.7/dist-packages/paramiko/client.py", line 338, in connect t.start_client(timeout=timeout) File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py", line 500, in start_client raise e paramiko.ssh_exception.SSHException: Incompatible version (1.5 instead of 2.0) -
Django: How to order a query set for a foreign key by a field of referencing class
I've got two classes: class Manufacturer(models.Model): name = models.CharField(max_length=50) class Part(models.Model): name = models.CharField(max_length=255) manufacturer = models.ForeignKey( Manufacturer, verbose_name=_("Manufacturer"), null=True, blank=True, help_text=_("The manufacturer of the part.") ) Now I ned to make a query that fetches all parts linking to a particual manufacturer. This I've done with parts = self.part_set.all(). But Now I need to sort the order. so I assumed the .order_by() could do the trick so in the end I have def get_parts(self): return list(self.part_set.all().order_by('name')) Unfortunately this is not sorting correct. So my question is: What is the correct way on sort the list of objects referencing another object by some attribute? -
How to read log files from unix directories using python and return the output to javascript?
I have 3 Unix AIX servers/boxes. I am looking to write a python code to authenticate to the servers using SSH and then pull out some data from files (log files) present in the servers and return them to my web page using JavaScript? I am not familiar with django framework. Do I need to use it? I need help in knowing which would be the best approach to use for my requirement. I did some search in google and learnt about something as Brython / Sculpt? Do I need to use these? I am not sure. Any help would be appreciated. -
python comma separate values by thousands without trailing zeros
I am trying to comma separate float amount by thousands. I am able to do that using the locale.format() function. But the expected output is not considering the decimal points. import locale locale.setlocale(locale.LC_ALL, 'en_US') amount = locale.format('%d', 10025.87, True) amount '10,025' My expected output should be 10,025.87, keeping the trailing values. Please let me know if something of this sort is possible Value: 1067.00 Output: 1,067 Value: 1200450 Output: 1,200,450 Value: 1340.9 Output: 1,340.9 -
Elastic Beanstalk installing scipy
I'm trying to install scipy on a bare-bones Django app running on Amazon Elastic Beanstalk, but I can't get it to work. Here are the steps to reproduce my problem: The regular stuff from the guide: # Create a new virtual environment mkvirtualenv -p python2.7 django_eb # Install Django on it pip install django==1.9.12 # pip freeze should now show Django==1.9.12 and some other things # Start a new Django project # This creates a directory that has everything you need for Django django-admin startproject django_eb cd django_eb # Optionally check that the site works python manage.py runserver Ctrl-C # Store the pip requirements so that the remote host can install them pip freeze > requirements.txt # Tell the remote server where our wsgi file is mkdir .ebextensions cat <<EOT >> .ebextensions/django.config option_settings: aws:elasticbeanstalk:container:python: WSGIPath: django_eb/wsgi.py EOT # Allow any host for our project # If this is unset, you'll get a 404 on the deployed site set ALLOWED_HOSTS = ['*'] in settings.py # Create an EB project # Will need AWS EB CLI for this eb init -p python2.7 django_eb # Choose some region eb init # choose Y so we can SSH and check logs # Create a … -
use GenericAPIView for different seriailizers based on different condition
Due to the use of different serializers based on certain condition, i preferred to use APIView and override get function. I was content with APIView but now that i need pagination feature, I am having trouble to make it happen. That is why i want to switch to GenericAPIView but due to the use of multiple serializer I have no idea how can i do it. class ItemsAPIView(APIView): permission_classes = (permissions.IsAuthenticated,) pagination_class = api_settings.DEFAULT_PAGINATION_CLASS def get(self, request, format=None): """ Return a list of all devices of this user. """ reply = {} try: products = BaseItem.objects.owned_items().filter(owner=request.user) reply['data'] = OwnedItemSerializer(products, many=True).data items = BaseItem.objects.dev_items().filter(owner=request.user) reply['data'].extend(ItemSerializer(items, many=True).data) except: reply['data'] = [] return Response(reply, status.HTTP_200_OK) -
Print form validation errors in Django
I am using registration-redux for Django and cannot get the error codes to display inline when the wrong username or password is entered. Oddly enough, if either is left blank, it shows the error message for that. I have left out the password bit to make the example brief. <form method="post" action="?next={{ next|default:"/" }}" class="form-horizontal"> {% csrf_token %} <div> <div> <label for="id_username">Username:</label> # HERE IS THE BIT THAT IS FAILING {% if form.username.errors %} {{ form.username.errors }} {% endif %} {{ form.username }} </div> </div> ... Does anyone see problem with what I am doing here? I also had the {{ form. username.errors }} bit wrapped in a tag but it didn't help. -
combine ListModelMixin with APIView to show pagination
I want to show the pagination feature in my api and i am using APIView with multiple serializer. I know if using ListView, it is very easy to show pagination. I have seen somewhere that combining ListModelMixin and APIView works but with the kind of my code, how can i combine them so i can show pagination? class ListModelMixin(object): def list(self, request, *args, **kwargs): queryset = self.filter_queryset(self.get_queryset()) page = self.paginate_queryset(queryset) if page is not None: serializer = self.get_serializer(page, many=True) return self.get_paginated_response(serializer.data) serializer = self.get_serializer(queryset, many=True) return Response(serilaizer.data) class ItemsAPIView(APIView): permission_classes = (permissions.IsAuthenticated,) pagination_class = api_settings.DEFAULT_PAGINATION_CLASS def get(self, request, format=None): """ Return a list of all devices of this user. """ reply = {} try: products = BaseItem.objects.owned_items().filter(owner=request.user) reply['data'] = OwnedItemSerializer(products, many=True).data items = BaseItem.objects.filter(owner=request.user) reply['data'].extend(ItemSerializer(devices, many=True).data) except: reply['data'] = [] return Response(reply, status.HTTP_200_OK) -
Multiple reset passwords in django
I have a project which have a personal app, where the login takes place, and a question app which also includes a profile page. I have managed to reset pasword from the login page, but when I try to do the same in the question app (using different templates, because I do not want the same on these pages), it just goes directly to the login reset template. I thought it would be enough to just add a new registration folder in the questions app, but it still goes searching in the personal app I think. Is it possible to just fix this using the django auth views or do I have to create my own views for the questions app? -
How to have Anaconda autocomplete Django?
I am trying to switch from PyCharm to ST3 but I can't get the Anaconda plugin to autocomplete Django stuff. For example, within a model: content = models.TextField(blank=True, default='') Anaconda can't autocomplete this. When I type models.Tex, it doesn't offer any autocompletion. I'm using a virtualenv inside my Django project within .venv/ (on Mac) and tried setting the "python_interpreter" config key to the interpreter within the virtualenv. It didn't help. I have looked at this question on SO but it didn't help either. What can I try? -
Filtering Choice field in django model Form based on F.K relation
Here is my sample model in model.py: class Division(models.Model): title = models.CharField(max_length=10, unique=True) ...... class Place(models.Model): name = models.CharField(max_length=50, unique=True) division = models.ForeignKey(Division, related_name='places') ..... class Story(models.Model): story_division = models.ForeignKey(Division) story_page = models.ForeignKey(Place) ...... And in my forms.py : class storyForm(forms.ModelForm): class Meta: model = Story fields = ('story_division','story_page'...) ...... Now my storyForm shows two choice field, Division and Place, what i want is to dynamically filter from the dropdown list where places are related to its above division choice. How do i do that ? -
Django 'AsgiRequest' object has no attribute 'content_type'
I am working on developing a django app named app, which is a part of a django project, but i am getting some problems when try to login admin. import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = 'something' DEBUG = True ALLOWED_HOSTS = ['*'] INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'connections', 'custom_user', 'chat', 'channels', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'testpoject.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'traego.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'testproject', 'USER': 'admin_testproject', 'PASSWORD': 'passw123', 'HOST': 'localhost', 'PORT': '', } } AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True STATIC_ROOT = os.path.join(BASE_DIR, "static") STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static-temp')] STATIC_URL = '/static/' LOGIN_URL = 'login' LOGIN_REDIRECT_URL = '/home' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') AUTH_USER_MODEL = 'custom_user.EmailUser' CHANNEL_LAYERS = { "default": { "BACKEND": "asgi_redis.RedisChannelLayer", "CONFIG": { "hosts": [os.environ.get('REDIS_URL', 'redis://localhost:6379')], }, "ROUTING": "chat.routing.channel_routing", }, } LOGGING = { 'version': 1, … -
Python Django equivalent of Java JSF message and label bundles
I am new to the world of Django and have a fair amount of experience using Java and Java Server Faces. One thing I have a habit of doing while coding websites in Java is to pull out the site's content strings into external properties files and pulling them into the app as resource bundles. This puts all the site's labels and messages into a central location where any changes can be made easily. It also supports the use of different language files. When going through the Django documentation, I have not seen anything that exactly resembles these properties files. Python has a ConfigParser object but I feel like this would be overkill. Also, Django offers internationalization/translation support. Seeing no other option I assume that the internationalization/translation modules of Django will end up being what I need to use. I will default the language to English and use the internationalization property files to consolidate the content messages. Before I do that, however, I wanted to check with the online community to make sure I'm not overlooking some other method. I have been through the online documentation and so far the i18N and l10N packages are all that I've seen that … -
Loading JavaScript files selectively in Django
I have Post model for a blog app in Django. It has a field named body. In posts, I may use Latex so I need to use MathJax.js. In some posts, I add code snippet, so I use highlight.js. In some I use both, in some I use none of them. I want to load the relevant javascript depending on the body field of the Post model (similar to THIS). How can I make the relevant .js file(s) to load automatically? I know that I can add an indicator field like hasLatex (True, False) or hasCode (True, False). But I'm lazy, I want Post.body to be automatically scanned and only relevant js files loaded. -
load part of the html page when filtering results with ajax
I want to filter a search results using 3 checkboxs. The results are presented in the div with the id=posts_results <div class="checkbox"> <label><input type="checkbox" id="id1" class="typePost" value="En groupe"> val1 </label> </div> <div class="checkbox"> <label><input type="checkbox" id="id2" class="typePost" value="En groupe"> val2 </label> </div> <div class="checkbox"> <label><input type="checkbox" id="id3" class="typePost" value="A domicile"> val3</label> </div> <div class="checkbox"> <label><input type="checkbox" id="id4" class="typePost" value="Par webcam"> val4</label> </div> <div id="posts_results"> {% include 'posts/posts_results.html' %} </div> <script> $('.typePost').change(function (request, response) { var v1=$('#id1').is(":checked")? 1:0; var V2=$('#id2').is(":checked")? 1:0; var V3=$('#id3').is(":checked")? 1:0; var v4=$('#id4').is(":checked")? 1:0; $.ajax({ url: '/posts/type_lesson/', dataType: 'json', type: "GET", data: { group: groupChecked, webcam: webcamChecked, home: homeChecked, move: moveChecked, distance: distance, }, success: function (object_list) { $('#posts_results').load(this, object_list); alert('after') } }); }); <script> this is my url: url(r'^filter/$', views.filter, name='filter_type_lesson'), and this is my view: def filter(request): if request.method=='GET': #as an exemple I'll send all posts data= PostFullSerializer(Post.objects.all(), many=True) return JsonResponse(data.data, safe=False) The filter function excute some filters according to the json sent data, serialize the filtered posts and send them back (in this case I send all the posts as an example). The results are displayed using a forloop in the div with id "posts_results" and the html is in the file posts_results.html. The json … -
Django follow primary key JSON
I relatively new to Django, but im trying to return the complete JSON document for the following data model. class Wheels(models.Model): w_name = models.CharField(max_length=255) w_weight = models.IntegerField(default=200) w_size = models.CharField(max_length=200) w_durability = models.IntegerField(default=45) def __str__(self): return self.w_name class Chassis(models.Model): c_owner = models.CharField(max_length=255) c_year = models.IntegerField(default=1900) c_model = models.CharField(max_length=255) c_wheels = models.ForeignKey(Wheels) c_weight = models.IntegerField(default=20) def __str__(self): return self.c_model` Right now the code returns just: { "id": 1, "c_owner": "Mike", "c_year": 1969, "c_model": "Chevy", "c_weight": 3500, "c_wheels": 1 } But instead of the 1 for wheels i would like it to follow the wheels table Views: class ChassisList(ModelViewSet): queryset = Chassis.objects.all() serializer_class = ChassisSerializer class WheelsList(ModelViewSet): queryset = Wheels.objects.all() serializer_class = WheelSerializer Serializers: class WheelSerializer(serializers.ModelSerializer): class Meta: model = Wheels fields = ('__all__') class ChassisSerializer(serializers.ModelSerializer): class Meta: model = Chassis fields = ('__all__') -
Do I need to know SQL when I work with Django
I am directing this question to experienced, Django developers, so as in subject, I have been learning Django since September 2016, but I've started to learn it without any knowledge about databases syntax. I know basic concepts and definitions, so I can easily implement in Django models. Summarizing, have I to know SQL to create web apps in Django? Thanks in advance. -
How to create and put variable into block in Django templating engine?
I want to create variable inside "if" block and call this var in other place {% for obj in events %} {% if obj.calendar == instance %} {% my_var = obj.title %} <div class="col-md-2"> <div class="thumbnail" data-toggle="modal" data-target="#myModal"> <div class="event_title">{{ obj.title }}</div> <div class="event_content">{{ obj.content }}</div> </div> </div> {% endif %} {% endfor %} -
How to secure HTTPS on Django using Pythonanywhere?
I'd like to be able to have a securee site (https) with the green padlock. I followed this tutorial from pythonanywhere's help center a month ago, https://help.pythonanywhere.com/pages/LetsEncrypt/ and I set up everything correctly : git clone https://github.com/lukas2511/dehydrated.git ~/dehydrated mkdir -p ~/letsencrypt/wellknown cd ~/letsencrypt WELLKNOWN=/home/YOURUSERNAME/letsencrypt/wellknown ~/dehydrated/dehydrated --cron --domain www.yourdomain.com --out . --challenge http-01 The problem is that when I enter my site using https I get a message and cannot access my site since Google warns me of the risk of the site. I tried to use www.whynopadlock.com to find what was wrong and here is what it gives : SSL verification issue (Possibly mis-matched URL or bad intermediate cert.). Details: ERROR: no certificate subject alternative name matches SSL verification issue (Possibly mis-matched URL or bad intermediate cert.). Details: ERROR: no certificate subject alternative name matches. Have anyone set up an HTTPS using Pythonanywhere ? What are the steps to set up correctly so the green padlock is there. -
Django Model field needs to be unique over multiple models with shared abstract base class
Suppose I want to have multiple kinds of articles, all reachable on site.com/news/article-slug (so depending on article-slug, it can be a video article, a text article, an image slider article, ...) I have these models: class Article(models.Model): class Meta: abstract = True slug = models.SlugField(max_length=60, unique=True) class TextArticle(Article): content = models.TextField() class VideoArticle(Article): video = models.ForeignKey(Video) But the problem is that I can create a TextArticle and a VideoArticle with the same slug. Is there an easy way to fix it so that if there's already a VideoArticle with a specific slug, no TextArticle can be added with the same slug (and vice versa)? If there's no easy fix: should I go for custom form validation with database querying? should I not make the base class abstract? any other ideas? Thanks in advance! -
Heroku error : Compiled slug size: 624.7M is too large (max is 300M) - using miniconda for scipy and numpy
I am working with Python 2.7.11, Django 1.9 and Heroku. I need to use scipy and numpy. Everything works well locally but Heroku returns an error when I push the application : "Compiled slug size: 624.7M is too large (max is 300M)" I therefore deleted the buildpack Heroku/Python and added this one: https://github.com/kennethreitz/conda-buildpack I kept the file requirements.txt: django==1.9.2 boto==2.41.0 dj-database-url==0.4.1 Django==1.9.2 django-allauth==0.28.0 django-appconf==1.0.2 django-autocomplete-light==3.1.6 django-toolbelt==0.0.1 gunicorn==19.6.0 pep8==1.7.0 Pillow==4.0.0 psycopg2==2.6.1 pytz==2016.10 sorl-thumbnail==12.3 virtualenv==15.1.0 sendgrid==3.2.10 python_http_client==2.2.1 django-s3-folder-storage==0.3 django-debug-toolbar==1.5 celery==3.1.25 redis==2.10.5 tweepy==3.5.0 geopy==1.11.0 django-mptt==0.8.7 mistune==0.7.3 django-widget-tweaks==1.4.1 django-cleanup == 0.4.2 django-unused-media == 0.1.6 python-memcached == 1.58 python-binary-memcached == 0.26.0 django-bmemcached == 0.2.3 whitenoise==3.2 coverage == 4.3.4 raven == 6.0.0 newrelic == 2.82.0.62 ajaxuploader==0.3.8 awscli==1.10.47 botocore==1.4.37 colorama==0.3.7 dj-static==0.0.6 django-libs==1.67.4 django-user-media==1.2.3 docutils==0.12 ecdsa==0.13 flake8==2.5.4 jmespath==0.9.0 mccabe==0.5.0 oauthlib==1.1.2 paramiko==2.0.1 pyasn1==0.1.9 pycrypto==2.6.1 pyflakes==1.2.3 python-openid==2.2.5 requests==2.9.1 requests-oauthlib==0.6.1 rsa==3.4.2 s3transfer==0.0.1 simplejson==3.8.2 six==1.10.0 static3==0.7.0 futures==3.0.5 and added a conda-requirements.txt with: nomkl python=2.7.11 numpy=1.11.1 scipy=0.19.0 scikit-learn==0.18.1 Here is the complete Heroku build log (too many lines to fit here): https://gist.github.com/jpuaux/74cb50a6cfb2dcab80d25d1809ae01c2 Thanks for any help you can provide! -
ValueError: invalid literal for int() with base 10: 'NULL'
When I run python manage.py migrate on my file, this ValueError shows up. Operations to perform: Apply all migrations: admin, auth, cms, contenttypes, sessions Running migrations: Applying cms.0002_auto_20170401_2307...Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "C:\Users\sndys\project\lib\site-packages\django\core\management\__init__.py", line 367, in execute_from_command_line utility.execute() File "C:\Users\sndys\project\lib\site-packages\django\core\management\__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\sndys\project\lib\site-packages\django\core\management\base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "C:\Users\sndys\project\lib\site-packages\django\core\management\base.py", line 345, in execute output = self.handle(*args, **options) File "C:\Users\sndys\project\lib\site-packages\django\core\management\commands\migrate.py", line 204, in handle fake_initial=fake_initial, File "C:\Users\sndys\project\lib\site-packages\django\db\migrations\executor.py", line 115, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "C:\Users\sndys\project\lib\site-packages\django\db\migrations\executor.py", line 145, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "C:\Users\sndys\project\lib\site-packages\django\db\migrations\executor.py", line 244, in apply_migration state = migration.apply(state, schema_editor) File "C:\Users\sndys\project\lib\site-packages\django\db\migrations\migration.py", line 129, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "C:\Users\sndys\project\lib\site-packages\django\db\migrations\operations\fields.py", line 84, in database_forwards field, File "C:\Users\sndys\project\lib\site-packages\django\db\backends\sqlite3\schema.py", line 231, in add_field self._remake_table(model, create_fields=[field]) File "C:\Users\sndys\project\lib\site-packages\django\db\backends\sqlite3\schema.py", line 113, in _remake_table self.effective_default(field) File "C:\Users\sndys\project\lib\site-packages\django\db\backends\base\schema.py", line 221, in effective_default default = field.get_db_prep_save(default, self.connection) File "C:\Users\sndys\project\lib\site-packages\django\db\models\fields\related.py", line 909, in get_db_prep_save return self.target_field.get_db_prep_save(value, connection=connection) File "C:\Users\sndys\project\lib\site-packages\django\db\models\fields\__init__.py", line 755, in get_db_prep_save prepared=False) File "C:\Users\sndys\project\lib\site-packages\django\db\models\fields\__init__.py", line 938, in get_db_prep_value value = self.get_prep_value(value) File "C:\Users\sndys\project\lib\site-packages\django\db\models\fields\__init__.py", line 946, in get_prep_value return int(value) ValueError: invalid literal for int() with base 10: 'NULL' My models.py file: … -
Difference between ajax and django channels
How exactly are ajax and django-channels different? and when to use what?