Re: why is a text not displayed?

2017-12-21 Thread pradam programmer
Change to this:

path('^$', views.index, name='index'),


On Thu, Dec 21, 2017 at 5:21 PM,  wrote:

> I made this along a tutorial.
> However
>
> "Hello, world. You're at the blog index."
>
> is not displayed.
>
> """blog/views.py"""
> from django.http import HttpResponse
>
>
> def index(request):
> return HttpResponse("Hello, world. You're at the blog index.")
>
> """blog/urls"""
> from django.urls import include, path
> from django.contrib import admin
> from . import views
>
> urlpatterns = [
> path('', views.index, name='index'),
> path('blog/', include('blog.urls')),
> path('admin/', admin.site.urls),
> ]
>
>
>
> --
> 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/985ce4a9-1288-40fa-9aea-6510f6c84d6a%40googlegroups.com
> 
> .
> 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/CAGGVXBNd1Y2XKtxOgw8QdTP%3DWGks%2BCF95WXNz5SHeUsuGM%3DAdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: No Reverse Match Exception

2017-12-17 Thread pradam programmer
>From this:
Update
Change to this:
Update

On 17-Dec-2017 2:00 PM, "yingi keme"  wrote:

> The problem is that, it works perfectly when i put the number on the
> template like this
>
> Update
>
> But when i do
>
> Update
>
> It gives the No Reverse Error. I dont seem to understand why
>
> Yingi Kem
>
> On 16 Dec 2017, at 11:18 AM, Любопытный Енот  wrote:
>
> try fix your pattern to
>
> r'^/Core/UpdateMe/(?P\\d+)/$'
>
>
> суббота, 16 декабря 2017 г., 12:22:49 UTC+3 пользователь yingi keme
> написал:
>>
>> I am using the django generic UpdateView
>>
>> class UserUpdate(UpdateView):
>> model = User
>> fields = ['first_name', 'last_name', 'email', 'username']
>> template_name = 'Core\MyUpdate.htm'
>>
>> And my url pattern is this:
>>
>> url(r'^UpdateMe/(?P\d+)/$', UserUpdate.as_view(), name='Update')
>>
>> However, this url  Core/UpdateMe/34/ doesnt seem to match and it gives
>> this error
>>
>> NoReverseMatch at /Core/UpdateMe/34/
>>
>> Reverse for 'Update' with arguments '('',)' not found. 1 pattern(s) tried: 
>> ['Core/UpdateMe/(?P\\d+)/$']
>>
>>
>>
>> --
> 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/867231ed-4b2e-4882-87c5-d482579dc182%40googlegroups.com
> 
> .
> 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/249DD07C-736B-4861-A32B-2C00FC04E960%40gmail.com
> 
> .
> 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/CAGGVXBPV1H%2BiT7gDb3DmDVOm%2B94i8wOr0KH%2BwEf97jGRfGFtmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: typeerror : context must be a dict rather than Context.

2017-12-12 Thread pradam programmer
c = template.Context({'now': now})
html = t.render(c) # Just pass {'now': now} instead of c

On Tue, Dec 12, 2017 at 5:08 PM, Al Scham  wrote:

> Hi,
>
> I'm am new to django and am workng through the OverIQ tutoiral at :
> https://overiq.com/django/1.10/loading-templates-in-django
>
> I have followed the instructions to the letter but am getting the
> typeerror every time (see subject).
>
> Heres is my views.py
>
> from django.shortcuts import render
> from django.http import HttpResponse
> from django import template
> import datetime
>
> def index(request):
> return HttpResponse("Hello Django")
>
> def today_is(request):
> now = datetime.datetime.now()
> t = template.loader.get_template('blog/datetime.html')
> c = template.Context({'now': now})
> html = t.render(c)
> return HttpResponse(html)
>
> *and here is my template:*
>
>
> 
> 
> 
> 
> Current Time
> 
> 
>
> {#This is a comment #}
> {check the existence of now variable in the template using if tag #}
> {% if now %}
> Current date and time is {{ now }}
> {% else %}
> now variable is not available
> {% endif %}
>
> 
> 
>
> *Any help would be aprreciated.*
>
> *Thanks*
>
> --
> 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/bfcbafcb-c748-4a7b-8594-eb22e701b256%40googlegroups.com
> 
> .
> 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/CAGGVXBPgKDBfDtKSVSxvn9pkWBeK-m2%2BeO4PGHAeSkBdEPqm_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Converting any Graphical Chart(pie-chart, gantt chart) into image dynamically.

2017-11-27 Thread pradam programmer
Thanks alot Derek..I will try this package.

On 27-Nov-2017 7:45 PM, "Derek"  wrote:

> Try reportlab:
>
> https://docs.djangoproject.com/en/1.11/howto/outputting-pdf/
> #write-your-view
> https://www.blog.pythonlibrary.org/2016/02/18/reportlab-how-
> to-add-charts-graphs/
> https://www.reportlab.com/chartgallery/bar/
>
> The actual data generation will of course be specific to your database and
> models.
>
> On Monday, 27 November 2017 13:49:10 UTC+2, pradam.programming wrote:
>>
>> Hi Guys,
>>
>> I want to convert an graphical chart,for an Ex: pie-chart,gantt chart
>> into an image in a real time and display it in a PDF Document dynamically.
>>
>> --
> 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/ms
> gid/django-users/d48a736b-b739-4159-a174-ed2ad162cc1e%40googlegroups.com
> 
> .
> 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/CAGGVXBNWNQTAin-ii4vdazdRWinoWnpW7uYkUm7caCd83ws0aw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Converting any Graphical Chart(pie-chart, gantt chart) into image dynamically.

2017-11-27 Thread pradam programmer
Hi Guys,

I want to convert an graphical chart,for an Ex: pie-chart,gantt chart into
an image in a real time and display it in a PDF Document dynamically.

-- 
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/CAGGVXBOjunnZUhRmzZNXAZLngA6hD%3DzGwKzGbVv_adPNxB3zYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get JOSN Field key value using values()

2017-06-08 Thread pradam programmer
Hi Mallik,
Write a Custom Method to do it.

On Thu, Jun 8, 2017 at 3:21 PM, Mallik Sai  wrote:

> I have a JSON Field in my model and I want to get a particular Key value
> which is present in the JSON Field using values().
>
> lets assume my JOSN Field data is like { 'key1':value1 , 'key2':value2
> ,'key3':value3 }
>
> I want to give the query like MyModel.objects.values('field1' , 'field2'
> , 'key2(which is present in Json Field)')
>
> Please help me whether I can get in using values() or How can I override
> the values() functionality
>
> --
> 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/127677de-e547-47cc-802f-9c59b5ebf839%40googlegroups.com
> 
> .
> 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/CAGGVXBM7y0iE1q2%3D%3D-P%3DFbK4-wFDH3UUDXG71f%2BnkdB8SvnJRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Deactivate the Child Objects when parent is deactivate.

2017-05-28 Thread pradam programmer
from django.db.models import QuerySet
import attr
from attr.validators import instance_of

@attr.s
class ChildDeactivate(object):
loca = attr.ib(validator=instance_of(QuerySet))

def deactivate_child(self,l):
get_parent = Boundary.objects.filter(parent__id=l.id)
if get_parent:
deact_child = map(lambda x: x.switch(),get_parent)
else:
l.switch()
return l.name, l.get_active_display(), l.boundary_level

def list_all(self):
for i in self.loca:
name_bound, status, level = self.deactivate_child(i)
print '{} is change to {} status of level
{}'.format(name_bound, status, level)

l = Boundary.objects.filter(parent__id=2)
*s = ChildDeactivate(l)*
*s.list_all()*

In my location models i have 9 levels, i wrote this snippet to deactivate
children objects when parent is deactivated, so anything to do to make it
more generic all the over models..?

-- 
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/CAGGVXBMmF%3D7ityZ520qpgmcnJRHvYkWNyMLM1L%2BXH1yQ-KH6%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: it says there is no module django when im trying to configure urls. please help

2017-04-20 Thread pradam programmer
Hi Anusha,
Make sure django is package is installed.

On Fri, Apr 21, 2017 at 3:15 AM, sri anusha  wrote:

> C:\Users\srian\AppData\Local\Programs\Python\Python36\python.exe
> C:/Users/srian/internship/polls/urls.py
> Traceback (most recent call last):
>   File "C:/Users/srian/internship/polls/urls.py", line 1, in 
> from django.conf.urls import url
> ModuleNotFoundError: No module named 'django'
>
> Process finished with exit code 1
>
> --
> 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/e438904e-e90a-4686-8f84-7017b7b40864%40googlegroups.com
> 
> .
> 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/CAGGVXBM2xBmiMebKQYc1PJcGiNhVd69XuGttrsNguEmtE8U%3Dfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django allauth, manage redirect

2017-02-07 Thread pradam programmer
Hi,
add this line in settings.py:
LOGIN_REDIRECT_URL = "/my-tasks/"

On Tue, Feb 7, 2017 at 2:09 PM, Branko Zivanovic <
international11...@gmail.com> wrote:

> I'm using django-allauth for authentication. I've enabled Facebook and
> Google for social logins. How do I make redirect after first login? I want
> to make people edit their profiles instantly after their first login.
>
> --
> 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/70fcb12c-f1fc-41b1-944d-47d5c0c756f5%40googlegroups.com
> 
> .
> 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/CAGGVXBMuEfUpTP2zBXXjtX3M%3D7Z9Gy7f_0RxVsHMRo-YMwZTxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: New to the community

2017-02-07 Thread pradam programmer
hi,

you can try this video tutorials its easily understandable

https://www.youtube.com/playlist?list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy

On Tue, Feb 7, 2017 at 12:31 PM, Antonis Christofides <
anto...@djangodeployment.com> wrote:

> Hello,
>
> except for Django's official tutorial, which is quite good, many people
> seem to like the Django Girls tutorial.
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
>
> On 02/06/2017 09:46 PM, Mavlonbek Muratov wrote:
>
> Hi there. I am happy to be part of this community. I am a beginner django
> user so would love to hear from you about recommendations. Anythig is fine,
> books, videos, blogs, forums whatever you think can be helpful to learn
> django. I would really appreciate your help. Thanks.
> --
> 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/18d9cdac-e47a-47a7-a10f-4cabf615934f%40googlegroups.com
> 
> .
> 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/fe265529-df76-c95f-6589-438fbcd80db2%
> 40djangodeployment.com
> 
> .
>
> 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/CAGGVXBOiNrshK9y8EK-KfbrFsnKteai6E3MGk8GTBNgJ-_9NNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Aggregation and following relationships backwards multiple levels

2017-02-01 Thread pradam programmer
Hi Patrick,
you can do like this:
def total(self):
return ContractItem.objects.filter(contract__subbudget__budge__in=
self.budget_set.all()).aggregate(Sum('total'))['total__sum']

try like this..!

On Wed, Feb 1, 2017 at 7:14 PM, Patrick Joy  wrote:

> Hi all,
>
> Would appreciate some advice on this, I'm having trouble working out the
> best way to aggregate across multiple foreign key relationships. I have
> come up with the solution below however I'm not sure if this is the correct
> way to handle this situation. Any advice would be appreciated.
>
> Thanks
>
>
> As an example I have a model structure that is 5 levels deep with foreign
> keys between each level, cost information is recorded at the lowest level
> (ContractItem)
>
> --- Project
>|--- Budget
>   |--- SubBudget
>  |--- Contract
> |--- ContractItem - $100
>
> If I want to aggregate the total cost up to the top project level I do it
> in multiple steps like this:
>
> class Project(models.Model):
> name = models.CharField(max_length=50)
>
> def total(self):
> subbudgets = SubBudget.objects.filter(budget__in=self.budget_set.
> all())
> contracts = Contract.objects.filter(subbudget__in=subbudgets)
> return ContractItem.objects.filter(contract__in=contracts).
> aggregate(Sum('total'))['total__sum']
>
>
> Is there a better way of doing this?
>
>
> Full working code:
>
> class Project(models.Model):
> name = models.CharField(max_length=50)
>
> def total(self):
> subbudgets = SubBudget.objects.filter(budget__in=self.budget_set.
> all())
> contracts = Contract.objects.filter(subbudget__in=subbudgets)
> return ContractItem.objects.filter(contract__in=contracts).
> aggregate(Sum('total'))['total__sum']
>
> def __str__(self):
> return self.name
>
> class Budget(models.Model):
> project = models.ForeignKey(Project)
> name = models.CharField(max_length=50)
>
> def __str__(self):
> return self.name
>
> def total(self):
> contracts = Contract.objects.filter(subbudget__in=self.subbudget_
> set.all())
> return ContractItem.objects.filter(contract__in=contracts).
> aggregate(Sum('total'))['total__sum']
>
>
> class SubBudget(models.Model):
> budget = models.ForeignKey(Budget)
> name = models.CharField(max_length=50)
>
> def __str__(self):
> return self.name
>
> def total(self):
> return ContractItem.objects.filter(contract__in=self.contract_
> set.all()).aggregate(Sum('total'))['total__sum']
>
>
> class Contract(models.Model):
> subbudget = models.ForeignKey(SubBudget)
> name = models.CharField(max_length=50)
>
> def __str__(self):
> return self.name
>
> def total(self):
> return self.contractitem_set.aggregate(Sum('total'))['total__sum']
>
> class ContractItem(models.Model):
> contract = models.ForeignKey(Contract)
> total = models.DecimalField(default=0.00, decimal_places=2,
> max_digits=12)
> name = models.CharField(max_length=50)
>
> def __str__(self):
> return self.name
>
> --
> 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/f1a3bfb7-f342-423d-8790-fc0d5bbcf151%40googlegroups.com
> 
> .
> 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/CAGGVXBNTWdS1ESfBWF2hQVqz2zoPYmURCkWY8j8b-wfiVzBQnw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Aggregation and following relationships backwards multiple levels

2017-02-01 Thread pradam programmer
from django.db.models import Q
def total(self):
subbudgets = SubBudget.objects.filter()
contracts = Contract.objects.filter(subbudget__in=subbudgets)
return
ContractItem.objects.filter(contract__subbudget__budget__in=self.budget_set.
all()).aggregate(Sum('total'))['total__sum']

On Wed, Feb 1, 2017 at 7:14 PM, Patrick Joy  wrote:

> Hi all,
>
> Would appreciate some advice on this, I'm having trouble working out the
> best way to aggregate across multiple foreign key relationships. I have
> come up with the solution below however I'm not sure if this is the correct
> way to handle this situation. Any advice would be appreciated.
>
> Thanks
>
>
> As an example I have a model structure that is 5 levels deep with foreign
> keys between each level, cost information is recorded at the lowest level
> (ContractItem)
>
> --- Project
>|--- Budget
>   |--- SubBudget
>  |--- Contract
> |--- ContractItem - $100
>
> If I want to aggregate the total cost up to the top project level I do it
> in multiple steps like this:
>
> class Project(models.Model):
> name = models.CharField(max_length=50)
>
> def total(self):
> subbudgets = SubBudget.objects.filter(budget__in=self.budget_set.
> all())
> contracts = Contract.objects.filter(subbudget__in=subbudgets)
> return ContractItem.objects.filter(contract__in=contracts).
> aggregate(Sum('total'))['total__sum']
>
>
> Is there a better way of doing this?
>
>
> Full working code:
>
> class Project(models.Model):
> name = models.CharField(max_length=50)
>
> def total(self):
> subbudgets = SubBudget.objects.filter(budget__in=self.budget_set.
> all())
> contracts = Contract.objects.filter(subbudget__in=subbudgets)
> return ContractItem.objects.filter(contract__in=contracts).
> aggregate(Sum('total'))['total__sum']
>
> def __str__(self):
> return self.name
>
> class Budget(models.Model):
> project = models.ForeignKey(Project)
> name = models.CharField(max_length=50)
>
> def __str__(self):
> return self.name
>
> def total(self):
> contracts = Contract.objects.filter(subbudget__in=self.subbudget_
> set.all())
> return ContractItem.objects.filter(contract__in=contracts).
> aggregate(Sum('total'))['total__sum']
>
>
> class SubBudget(models.Model):
> budget = models.ForeignKey(Budget)
> name = models.CharField(max_length=50)
>
> def __str__(self):
> return self.name
>
> def total(self):
> return ContractItem.objects.filter(contract__in=self.contract_
> set.all()).aggregate(Sum('total'))['total__sum']
>
>
> class Contract(models.Model):
> subbudget = models.ForeignKey(SubBudget)
> name = models.CharField(max_length=50)
>
> def __str__(self):
> return self.name
>
> def total(self):
> return self.contractitem_set.aggregate(Sum('total'))['total__sum']
>
> class ContractItem(models.Model):
> contract = models.ForeignKey(Contract)
> total = models.DecimalField(default=0.00, decimal_places=2,
> max_digits=12)
> name = models.CharField(max_length=50)
>
> def __str__(self):
> return self.name
>
> --
> 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/f1a3bfb7-f342-423d-8790-fc0d5bbcf151%40googlegroups.com
> 
> .
> 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/CAGGVXBMTGigxzNwU7p0%2BvX90DyHO%2BeBfV2J5HzinMggDV2KyqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


I want some guidance on Comments Table Structure

2017-01-11 Thread pradam programmer
Hi,
I'm creating the Generic model for Comments i have following scenerios:

1. Comments conversion should happen between one to one.
2. Comments should show based on particular programs id.


thank you.

-- 
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/CAGGVXBNCL%2BCW%3DZj4rEe%2Bgv6hf8hUab7Y%2BADcSvjLMjWr4zgYvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is the best combination of components to be used with Django on Windows 10?

2017-01-03 Thread pradam programmer
hi,
Please Refer this Link
https://www.toptal.com/django/installing-django-on-iis-a-step-by-step-tutorial


On Mon, Dec 26, 2016 at 3:28 PM, James Bennett 
wrote:

> On Mon, Dec 26, 2016 at 1:31 AM, Avraham Serour  wrote:
>
>> http://lmgtfy.com/?q=django+deploy+iis
>>
>>
> This is a rude and dismissive way to respond to someone who asked a
> question; please do not do this in the future, and for further information
> check out the Django community's Code of Conduct[1], which begins with "Be
> friendly and patient".
>
> [1] https://www.djangoproject.com/conduct/
>
> --
> 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/CAL13Cg-iZbRZy4GWYQ1Na3OzmK_MbvVmzVLYUsVLd0k0S8YxBg%
> 40mail.gmail.com
> 
> .
>
> 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/CAGGVXBNt9eZqRfodQtHumSb_ri-dJ3QBS6b1tADMoZmPeANYaw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: understanding auth models

2017-01-02 Thread pradam programmer
Hi,
Read the django doc about auth user they have specified thoroughly

On 2 Jan 2017 7:48 pm, "Rasika"  wrote:

Hi,
  whenever I created the account for user using built in admin it get
stored into auth_user tablein the database.Where I can find the code for
this where the connections between the auth_user and save() so that I can
understand it to write my own table connections.

thank you

-- 
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/f453d7d0-822e-4a56-b4b6-e8cb3af1df1e%40googlegroups.com

.
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/CAGGVXBOg74L10TFbhpXnO1r0%3DySh6GZQ%2BXQL2oHOKLTdfMiXGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Happy New Year 2017

2016-12-31 Thread pradam programmer
Happy New Year Guys, i hope this year fill with alot of love, happiness and
Joy to everyone.

-- 
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/CAGGVXBOiUZcsYMyu237t2nirG%3DrzOD_v68b1AqYVkijk-fDk5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django stops working with RuntimeError: populate() isn't reentrant

2016-12-23 Thread pradam programmer
this is the traceback i am getting..
(dj-1.7)mahiti@mahiti:~/SST$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 14, in 
execute_from_command_line(sys.argv)
  File "/home/mahiti/dj-1.7/local/lib/python2.7/site-packages/
django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
  File "/home/mahiti/dj-1.7/local/lib/python2.7/site-packages/
django/core/management/__init__.py", line 354, in execute
django.setup()
  File 
"/home/mahiti/dj-1.7/local/lib/python2.7/site-packages/django/__init__.py",
line 21, in setup
apps.populate(settings.INSTALLED_APPS)
  File 
"/home/mahiti/dj-1.7/local/lib/python2.7/site-packages/django/apps/registry.py",
line 78, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant

On Fri, Dec 23, 2016 at 1:46 PM, Babatunde Akinyanmi <tundeba...@gmail.com>
wrote:

> How about the stack trace?
>
> On 22 Dec 2016 16:43, "pradam programmer" <pradam.programm...@gmail.com>
> wrote:
>
>> I restarted hundred times still can't able to rectify it
>>
>> On 22 Dec 2016 9:07 pm, "ADEWALE ADISA" <solixzsys...@gmail.com> wrote:
>>
>> Restart the server
>> On Dec 22, 2016 4:27 PM, "pradam programmer" <
>> pradam.programm...@gmail.com> wrote:
>>
>>> Hi Guys,
>>> I am unable to rectify this error I am doing the following things:
>>> 1. I am running the project in django 1.7 later upgraded to 1.7.11 to
>>> check whether I fix the issue but no use. :(
>>> 2. In settings.py I commented the allowed_host = [*] still no use :(
>>> I don't know why this error is coming..?
>>> Thank you
>>>
>>> --
>>> 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/ms
>>> gid/django-users/CAGGVXBN%2BkjQZeyr2gTMEQm8NLJA8s1MeLJ7tGsjh
>>> __wA5D-LLA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAGGVXBN%2BkjQZeyr2gTMEQm8NLJA8s1MeLJ7tGsjh__wA5D-LLA%40mail.gmail.com?utm_medium=email_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/ms
>> gid/django-users/CAMGzuy8QL1FEodO%2BW30g_c9w5z801jMrgdaM6y90
>> woraSjj6KQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMGzuy8QL1FEodO%2BW30g_c9w5z801jMrgdaM6y90woraSjj6KQ%40mail.gmail.com?utm_medium=email_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/ms
>> gid/django-users/CAGGVXBOKK1L-eVzduEqZ9P7-G2JE%3D-357nh0_
>> 1z3NaEhJ8YswA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAGGVXBOKK1L-eVzduEqZ9P7-G2JE%3D-357nh0_1z3NaEhJ8YswA%40mail.gmail.com?utm_medium=email_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-user

Re: starting django

2016-12-22 Thread pradam programmer
just correct pools to polls in url

On Thu, Dec 22, 2016 at 9:59 PM, Giovanni Oliverio 
wrote:

>
> Hello, I'm following the guide at the following link:
> https://docs.djangoproject.com/en/1.10/intro/tutorial01/ but when I go to
> call the page:  http://localhost:8000/polls/ the result is the following:
>
>
> 
>
>
>
> where am I wrong?
>
> --
> 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/e6332dc6-1b8e-4c98-bb9b-e966c49578be%40googlegroups.com
> 
> .
> 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/CAGGVXBNuWAi-PxA8ggqmmuy9OOLXkOUSd9Nm%3D7HWENw0rScZLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django stops working with RuntimeError: populate() isn't reentrant

2016-12-22 Thread pradam programmer
I restarted hundred times still can't able to rectify it

On 22 Dec 2016 9:07 pm, "ADEWALE ADISA" <solixzsys...@gmail.com> wrote:

Restart the server
On Dec 22, 2016 4:27 PM, "pradam programmer" <pradam.programm...@gmail.com>
wrote:

> Hi Guys,
> I am unable to rectify this error I am doing the following things:
> 1. I am running the project in django 1.7 later upgraded to 1.7.11 to
> check whether I fix the issue but no use. :(
> 2. In settings.py I commented the allowed_host = [*] still no use :(
> I don't know why this error is coming..?
> Thank you
>
> --
> 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/ms
> gid/django-users/CAGGVXBN%2BkjQZeyr2gTMEQm8NLJA8s1MeLJ7tGsjh
> __wA5D-LLA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGGVXBN%2BkjQZeyr2gTMEQm8NLJA8s1MeLJ7tGsjh__wA5D-LLA%40mail.gmail.com?utm_medium=email_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/CAMGzuy8QL1FEodO%2BW30g_c9w5z801jMrgdaM6y90woraSjj6KQ%
40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAMGzuy8QL1FEodO%2BW30g_c9w5z801jMrgdaM6y90woraSjj6KQ%40mail.gmail.com?utm_medium=email_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/CAGGVXBOKK1L-eVzduEqZ9P7-G2JE%3D-357nh0_1z3NaEhJ8YswA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django stops working with RuntimeError: populate() isn't reentrant

2016-12-22 Thread pradam programmer
Hi Guys,
I am unable to rectify this error I am doing the following things:
1. I am running the project in django 1.7 later upgraded to 1.7.11 to check
whether I fix the issue but no use. :(
2. In settings.py I commented the allowed_host = [*] still no use :(
I don't know why this error is coming..?
Thank you

-- 
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/CAGGVXBN%2BkjQZeyr2gTMEQm8NLJA8s1MeLJ7tGsjh__wA5D-LLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.