Model's Foreign Key Id Attribute not being updated

2016-11-25 Thread Michael Viveros
I have a Question model and a Choice model where a Question can have many Choices so the Choice model has a Foreign Key mapping to a Question. models.py: from django.db import models class Question(models.Model): text = models.CharField(max_length=200) title =

Best practice for implementing a dynamic "other" field in a group of radio buttons?

2016-11-25 Thread Quentin Fulsher
Hi all, I'm working on a form that has to support a few groups of radio buttons. I'm wondering if there is a recommended way to do an "other" radio button that can be dynamically set by the user. Like the user can select the "other" radio button and enter a custom string to be associated with

Re: user object not available in template

2016-11-25 Thread Drew Ferguson
I just upgraded from 1.5 or something where the code worked fine I'm not sure what has changed in 1.10 but everything is back to normal after I changed def homepage(request): return render_to_response('xstatic_homepage.html', RequestContext(request)) to def homepage(request): return

Re: user object not available in template

2016-11-25 Thread James Bennett
Ah, never mind, misread the question. Are you sure you're using a RequestContext? On Fri, Nov 25, 2016 at 3:23 PM, James Bennett wrote: > The auth context processor provides it, but not as a variable named > 'user'; instead it's attached to the 'request' variable, so

Re: user object not available in template

2016-11-25 Thread James Bennett
The auth context processor provides it, but not as a variable named 'user'; instead it's attached to the 'request' variable, so what you want is '{% if request.user.is_authenticated }}'. On Fri, Nov 25, 2016 at 3:02 PM, Drew Ferguson wrote: > Hi > > Using Django 1.10 > > In

user object not available in template

2016-11-25 Thread Drew Ferguson
Hi Using Django 1.10 In my templates there is no user object to provide user.is_authenticated Is there something I have to do to turn this on? My settings has this TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [],

where does logging configuration go?

2016-11-25 Thread bob gailer
https://docs.djangoproject.com/en/1.9/topics/logging/ shows some logging configurations, but does not tell me where to put them. Where would you suggest? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

question re built-in server

2016-11-25 Thread bob gailer
Sometimes requests get displayed at the console, other times they do not. Example: (myproject) C:\Users\bgailer\mysite>manage.py runserver 0.0.0.0:8000 Performing system checks... System check identified no issues (0 silenced). You have 1 unapplied migration(s). Your project may not work

Re: Filtering in ListView

2016-11-25 Thread Artem Bernatskyy
Wow, tried it and it is working like a charm ! -- 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,

Re: Bulk-creating two ForeignKey linked models - id field for relationship isn't set properly?

2016-11-25 Thread Michael Viveros
Victor Hooi, did you ever find a work-around? I'm having the same problem of trying to efficiently create models that have a Many to One relationship (so that they are linked by a Foreign Key). The ticket referenced above is still open and I

Re: numjobs returned from glassdoor API is not equal to it showed on the website

2016-11-25 Thread Tim Graham
This question doesn't seem related to Django usage. You'll probably have better luck asking somewhere more appropriate. On Friday, November 25, 2016 at 9:08:12 AM UTC-5, Darren Li wrote: > > I am trying to get some company information from glassdoor by itsAPI, but > i found the number of jobs

I am not able to access user_permissions without superuser access

2016-11-25 Thread shashank sharma
I created a user with some permissions by django AbstractUser model without superuser/staff access, a simple user can say. Now I can login successfully and when I am trying to access permissions of user like *request.user.user_permissions.all() *in my ListView it gives me an error like

numjobs returned from glassdoor API is not equal to it showed on the website

2016-11-25 Thread Darren Li
I am trying to get some company information from glassdoor by itsAPI, but i found the number of jobs returned from API is not equal to it showed on website for most companies. I am providing my api url and result as followed. I have two questions: 1. for 'Merkle', why numjobs on the website

Django FlatPageSitemap

2016-11-25 Thread Андрей Andreyu
Hi! i use https://docs.djangoproject.com/en/1.10/ref/contrib/flatpages/#installation Follow step 1,2,3 I add: url(r'^pages/', include('django.contrib.flatpages.urls')), to base urlpatterns And add test page in admin:

Mysql GeoDjango Distance search

2016-11-25 Thread Karesh Arunakirinathan
down votefavorite Is there any pure Django/faster way to get the distances less than x km. I have the model class Products(models.Model): title = models.CharField(max_length=10) point =

Re: Migrations and multiple databases

2016-11-25 Thread odd hogstad
Isn't that kind of stupid? fredag 25. november 2016 06.00.49 UTC+1 skrev pradam.programming følgende: > > Yes do the same. > > On Thu, Nov 24, 2016 at 11:16 PM, odd hogstad > wrote: > >> db1 holds the auth stuff already. Do I need to also have it in db2 for >> the

Re: Filtering in ListView

2016-11-25 Thread Sergiy Khohlov
simplest way is update get_content_data in view: Take a look at example : class CompanyDetail(TemplateVariables, LoggedInMixin, DetailView): """ """ model = Company template_name = 'company/company_detail.html' def cars(self): return

Re: Migrations for multiple Django versions

2016-11-25 Thread Dan Tagg
Hi Vlastimil, Why not use your source control system to publish different releases for different versions of django. Dan On 25 November 2016 at 10:01, Vlastimil Zíma wrote: > I don't think separate migrations would make the problem any better, that > looks just like more

Re: Migrations for multiple Django versions

2016-11-25 Thread Vlastimil Zíma
I don't think separate migrations would make the problem any better, that looks just like more complicated implementation of migrations with condition in it. Our use case: Our webs consist from several projects based on Django, with dependencies between them. One of the core projects

Re: Filtering in ListView

2016-11-25 Thread jorrit787
If you're ok with using an external package you can check out django-filter , it makes filtering very easy. On Thursday, November 24, 2016 at 8:35:30 PM UTC+1, Artem Bernatskyy wrote: > > Hello, > > how can i accomplish filtering in ListView via