HOTTEST PHOTO-SHOOTS OF THE SEXIEST MODELS N CELEBRITIES. GET THEM HERE
THE BEST SITES FOR THE NEWEST WALLPAPERS N GOSSIP N ALL THE OTHER HAPPENINGS IN BOLLYWOOD HOLLYWOOD N IN THE GLAMOROUS WORLD:- http://bollywood-dhamaal.blogspot.com/ http://comingup-bollywood.blogspot.com/ http://nasty-hollywood.blogspot.com/ http://fun-at-its-best.blogspot.com/ wanna earn money on any other kinda info abt how it works im jus a mail away!!! mail me at: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
EXCLUSIVE PHOTO-SHOOTS OF THE SEXIEST MODELS N CELBRITIES... MOST RARE PICS
THE BEST SITES FOR THE NEWEST WALLPAPERS N GOSSIP N ALL THE OTHER HAPPENINGS IN BOLLYWOOD HOLLYWOOD N IN THE GLAMOROUS WORLD:- http://bollywood-dhamaal.blogspot.com/ http://comingup-bollywood.blogspot.com/ http://nasty-hollywood.blogspot.com/ http://fun-at-its-best.blogspot.com/ http://glamour-worldd.blogspot.com/ wanna earn money on any other kinda info abt how it works im jus a mail away!!! mail me at: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs.
Hi, I am new to django and I appreciate your quick help. I am able to run django server on localhost:8000 but I am seeing this error : *You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs.* urls.py: from django.contrib import admin from django.urls import path, include from django.conf.urls import url from server.views import * urlpatterns = [ path('admin/', admin.site.urls), #path('', ReactView.as_view(),name="anything"), #path('', include('server.urls')), ] Settings.py: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'server', 'rest_framework', 'corsheaders', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] views.py: from django.shortcuts import render from rest_framework.views import APIView from . models import * from rest_framework.response import Response from . serializer import * # Create your views here. class ReactView(APIView): serializer_class = ReactSerializer def index(request): return render(request,'templates/meetups/index.html') def get(self, request): output = [{"employee": output.employee, "department": output.department} for output in React.objects.all()] return Response(output) def post(self, request): serializer = ReactSerializer(data=request.data) if serializer.is_valid(raise_exception=True): serializer.save() return Response(serializer.data) models.py: from django.db import models # Create your models here. class React(models.Model): employee = models.CharField(max_length=30) department = models.CharField(max_length=200) def __str__(self): return self.employee -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e1b2ede4-f460-4faa-a965-cfb9375fe549n%40googlegroups.com.
How to save foreign key along with parent object in django 1.10
Hi, I want to create a bunch of objects that are interconnected in my model (eg, one Book and one Author object) and then call save() on the Book object to add everything to the database. In other words, I don't want to save Author object explicitly. Example: class Author(models.Model): name = models.CharField(max_length=255L, blank=True) class Book(models.Model): author = models.ForeignKey(Author) I want to do: author = Author('Robert Frost') book = Book(author) book.save() Can this be done in Django 1.10 ? Regards, Priyanka -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/db02ab72-45a3-4f5d-a256-3a32bb4a35d7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
how to define migrations to use BigAutoField
Hi, We have recently migrated to django 1.10 and with prior version of Django 1.7 we had . a patch to convert AutoField to "BigInt" instead of "int". Since Django 1.10 provides capability to use BigAutoField for "BigInt", we don't want to patch anymore. Is there a way to define primary key as "BIgAutoField" in settings , so that we don't have to explicitly define "id" column for each model. Regards, Priyanka -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/88591094-b2ec-4e81-92b5-ca93557dec67%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
makemigrations running for all apps defined in INSTALLED_APPS
Hi, I am migrating from Django 1.7.4 to Django 1.10.0 and is facing issue while running migrations. I am running the comand : python manage.py makemigrations Scenario, is that we araccessing model from Oracle database, for which I don't have read/write permissions and i had to change the model definition in local source to add related_name . I want to skip/exclude this model while running makemigrations, but is not able to do so. I tried returning "False" in the router, but that also is not working. Please suggest solution/workaround. Also, please feel free to correct me , if I'm wrong. Data : Model : With Django 1.7: class PartVersionTree(models.Model): fk_partversion = models.ForeignKey(PartVersion, null=True, blank=True,db_column='FK_PARTVERSION') fk_associatedpartversion = models.ForeignKey(PartVersion, null=True, blank=True,db_column='FK_ASSOCIATEDPARTVERSION') Changed in Django 1.10: class PartVersionTree(models.Model): fk_partversion = models.ForeignKey(PartVersion, null=True, blank=True,db_column='FK_PARTVERSION', related_name = '%(class)s_fk_partversion') fk_associatedpartversion = models.ForeignKey(PartVersion, null=True, blank=True,db_column='FK_ASSOCIATEDPARTVERSION', related_name = '%(class)s_fk_associatedpartversion') Router definition: def allow_migrate(self, db, app_label, model_name=None, **hints): return False Regards, Priyanka -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6e1f61a6-176e-4659-b54a-8d8df27a9fdd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: makemigrations running for all apps defined in INSTALLED_APPS
Nothing helps till now !! Thanks, Priyanka On Tuesday, 6 June 2017 12:22:00 UTC+5:30, Priyanka Thakur wrote: > > Hi, > > I am migrating from Django 1.7.4 to Django 1.10.0 and is facing issue > while running migrations. > > I am running the comand : python manage.py makemigrations > > Scenario, is that we araccessing model from Oracle database, for which I > don't have read/write permissions and i had to change the model definition > in local source to add related_name . > > I want to skip/exclude this model while running makemigrations, but is not > able to do so. > > I tried returning "False" in the router, but that also is not working. > > Please suggest solution/workaround. Also, please feel free to correct me , > if I'm wrong. > > Data : > > > Model : > > With Django 1.7: > > class PartVersionTree(models.Model): > > fk_partversion = models.ForeignKey(PartVersion, null=True, > blank=True,db_column='FK_PARTVERSION') > > fk_associatedpartversion = models.ForeignKey(PartVersion, null=True, > blank=True,db_column='FK_ASSOCIATEDPARTVERSION') > > > > Changed in Django 1.10: > > > class PartVersionTree(models.Model): > fk_partversion = models.ForeignKey(PartVersion, null=True, > blank=True,db_column='FK_PARTVERSION', related_name = > '%(class)s_fk_partversion') > > fk_associatedpartversion = models.ForeignKey(PartVersion, null=True, > blank=True,db_column='FK_ASSOCIATEDPARTVERSION', related_name = > '%(class)s_fk_associatedpartversion') > > > > > Router definition: > > > def allow_migrate(self, db, app_label, model_name=None, **hints): > > return False > > > Regards, > Priyanka > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a73f46e8-69bc-4db5-9883-bc93376628d4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Custom field implementing Boolean Field is having response value as None instead of False
Hi, I am doing migration from Django 1.7 to 1.10 version and has a custom django field. Below is the custom class for the field: from django.db import models class HibernateBooleanField(models.BooleanField): def from_db_value(self, value, expression, connection, context): return self.to_python(value) def get_internal_type(self): return "HibernateBooleanField" def db_type(self, connection): return 'bit(1)' def to_python(self, value): if value in (True, False): return value if value in ('t', 'True', 'true', '1', '\x01'): return True if value in ('f', 'False', 'false', '0', '\x00', None): return False def get_db_prep_value(self, value, connection, prepared=False): return 0x01 if value else 0x00 def get_db_prep_save(self, value, connection): return 0x01 if value else 0x00 def get_prep_value(self, value): return self.to_python(value) --- I have defined a field in the model as: class MetaMetadata(models.Model): is_folder = HibernateBooleanField() When I invoke a POST request on API in my test case , I get the value for this field as "None" in response. The API is : response = self._client.post('/xyz/api/metametadatas/', {'edit_view': "TestEditView", 'grid_view': "TestGridView", 'name': "Test Metametadata", 'sort_key': 9000, 'parentid': 0, 'version':0, 'id': 100}, format='json') Please explain , what is it that I'm doing wrong. Why isn't to_python method getting invoked ? Am I missing something? Regards, Priyanka -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3e95b214-8a06-4482-b092-c9dd6a32b6fc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Custom field implementing Boolean Field is having response value as None instead of False
Hi Melvyn, I am checking for None in the last if condition in to_python method : --copy-- > if value in ('f', 'False', 'false', '0', '\x00', *None*): return > False --copy-- Thanks for checking and replying !! Regards, Priyanka On Friday, 16 June 2017 20:03:22 UTC+5:30, Priyanka Thakur wrote: > > Hi, > > I am doing migration from Django 1.7 to 1.10 version and has a custom > django field. > > Below is the custom class for the field: > > > > from django.db import models > > > > class HibernateBooleanField(models.BooleanField): > > def from_db_value(self, value, expression, connection, context): > > return self.to_python(value) > > > def get_internal_type(self): > > return "HibernateBooleanField" > > > def db_type(self, connection): > > return 'bit(1)' > > > def to_python(self, value): > > if value in (True, False): > > return value > > if value in ('t', 'True', 'true', '1', '\x01'): return True > > if value in ('f', 'False', 'false', '0', '\x00', None): return > False > > > def get_db_prep_value(self, value, connection, prepared=False): > > return 0x01 if value else 0x00 > > > def get_db_prep_save(self, value, connection): > > return 0x01 if value else 0x00 > > > def get_prep_value(self, value): > > return self.to_python(value) > > --- > > > I have defined a field in the model as: > > > > class MetaMetadata(models.Model): > > is_folder = HibernateBooleanField() > > > > When I invoke a POST request on API in my test case , I get the value for > this field as "None" in response. > > > The API is : > > > response = self._client.post('/xyz/api/metametadatas/', >{'edit_view': "TestEditView", > 'grid_view': "TestGridView", > 'name': "Test Metametadata", > 'sort_key': 9000, > 'parentid': 0, > 'version':0, > 'id': 100}, format='json') > > > > Please explain , what is it that I'm doing wrong. Why isn't to_python method > getting invoked ? Am I missing something? > > > Regards, > > Priyanka > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c89377a1-78cb-4b76-9518-39cd5181dcb8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Custom field implementing Boolean Field is having response value as None instead of False
Oh, ok got the point !! Thanks !! Regards, Priyanka On Monday, 19 June 2017 16:05:06 UTC+5:30, m712 - Developer wrote: > > Melvyn was not saying whether you were checking for None. If `value` is > i.e. "some string" your to_python method will return `None`. You should do > something like this: > > ``` > if value in ('t', ...): return True > elif value in ('f', ...): return False > else: return bool(value) # You can change this > ``` > On Jun 19, 2017 11:59 AM, Priyanka Thakur > wrote: > > Hi Melvyn, > > I am checking for None in the last if condition in to_python method : > > --copy-- > > > if value in ('f', 'False', 'false', '0', '\x00', *None*): return > > > False > > --copy-- > > > Thanks for checking and replying !! > > > Regards, > > Priyanka > > > On Friday, 16 June 2017 20:03:22 UTC+5:30, Priyanka Thakur wrote: > > Hi, > > I am doing migration from Django 1.7 to 1.10 version and has a custom > django field. > > Below is the custom class for the field: > > > > from django.db import models > > > > class HibernateBooleanField(models.BooleanField): > > def from_db_value(self, value, expression, connection, context): > > return self.to_python(value) > > > def get_internal_type(self): > > return "HibernateBooleanField" > > > def db_type(self, connection): > > return 'bit(1)' > > > def to_python(self, value): > > if value in (True, False): > > return value > > if value in ('t', 'True', 'true', '1', '\x01'): return True > > if value in ('f', 'False', 'false', '0', '\x00', None): return > False > > > def get_db_prep_value(self, value, connection, prepared=False): > > return 0x01 if value else 0x00 > > > def get_db_prep_save(self, value, connection): > > return 0x01 if value else 0x00 > > > def get_prep_value(self, value): > > return self.to_python(value) > > --- > > > I have defined a field in the model as: > > > > class MetaMetadata(models.Model): > > is_folder = HibernateBooleanField() > > > > When I invoke a POST request on API in my test case , I get the value for > this field as "None" in response. > > > The API is : > > > response = self._client.post('/xyz/api/metametadatas/', >{'edit_view': "TestEditView", > 'grid_view': "TestGridView", > 'name': "Test Metametadata", > 'sort_key': 9000, > 'parentid': 0, > 'version':0, > 'id': 100}, format='json') > > > > Please explain , what is it that I'm doing wrong. Why isn't to_python method > getting invoked ? Am I missing something? > > > Regards, > > Priyanka > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users...@googlegroups.com . > To post to this group, send email to django...@googlegroups.com > . > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/c89377a1-78cb-4b76-9518-39cd5181dcb8%40googlegroups.com > > <https://groups.google.com/d/msgid/django-users/c89377a1-78cb-4b76-9518-39cd5181dcb8%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f8506d24-7d7b-4f6f-8dae-5a3bea8396ea%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Custom field implementing Boolean Field is having response value as None instead of False
Hi Melvyn, Finally i had breakthrough and saw the root cause. The issue is that i haven't defined any default value for this Custom field in the model class. As per Django 1.10 documentation, the default value of Boolean Field is None if "default" value is not defined. Hence "None" value. Though surprising thing is , that when data is getting inserted , it's invoking proper custom field methods and inserting the value "0", but once the object is saved i.e. serializer.save () , the instance returned is containing the value "None" which it is getting from "to_representation " method. Regards, Priyanka On Monday, 19 June 2017 22:51:44 UTC+5:30, Melvyn Sopacua wrote: > > On Monday 19 June 2017 04:00:42 Priyanka Thakur wrote: > > > On Monday, 19 June 2017 16:05:06 UTC+5:30, m712 - Developer wrote: > > > > Melvyn was not saying whether you were checking for None. If `value` > > > > is i.e. "some string" your to_python method will return `None`. You > > > > should do something like this: > > > > > > > > ``` > > > > > > > > if value in ('t', ...): return True > > > > elif value in ('f', ...): return False > > > > else: return bool(value) # You can change this > > > > > > > > ``` > > > > That's correct for to_python. But personally, I would raise an exception > in from_db_value, since that indicates data corruption. > > > > In your case, there are only a handful of allowed values that should come > from the database. Anything else, will indicate somebody messing with your > data or upgrades of one of the libraries in between Django and the database > changed it's output format. Both of which will require attention. > > > > This is one advantage of from_db_value and to_python separation. > > > > -- > > Melvyn Sopacua > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/12c87832-75fa-42d2-9663-3846f2b471ce%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Result of queryset in Django 1.10 is not sorted
Hi, As part of migration to Django 1.10.4 from 1.7, I have noticed that queryset results are unsorted, compared to previous version. Has same behaviour been observed by anyone? Regards, Priyanka -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/777067c4-7a66-416d-8c5f-576566d6b4c1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
django-haystack filter engine with elastic search backend. It gaves a list of all engine but i want to display only one engine that matches with maker
class PartLookUpHaystackSerializer(HaystackFacetSerializer): serialize_objects = True class Meta: # The `index_classes` attribute is a list of which search indexes # we want to include in the search. index_classes = [PartIndex] # The `fields` contains all the fields we want to include. # NOTE : Make sure you don't confuse these with model attributes. These # fields belong to the search index! fields = [ 'title', 'description', 'partnumber', 'make', 'make_slug', 'year', 'fitment_model', 'fitment_model_slug', 'engine', 'parttype_slug', 'parttype', 'submodel', 'subcategory', 'engine', 'slug', 'id', 'coreprice', 'price', 'images', 'mfg_name', 'mfg_name_slug', 'sub_title', 'zipcode', 'third_party_name', 'quantity', 'modified_price', 'core_price', 'part_warranty', 'minimum_order_qty' ] field_options = { 'title': {}, 'description': {}, 'make_slug':{}, 'year':{}, 'fitment_model_slug':{}, 'parttype_slug':{}, 'submodel':{}, 'subcategory':{}, 'engine':{}, 'mfg_name':{}, 'mfg_name_slug':{} } -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c3f112d8-dbbb-4e17-9b26-15311760c399%40googlegroups.com.