Non Admin Dashboard/Shop Login for Suppliers

2016-08-20 Thread Ali khan
Hi,

I am using Django-registration for registration process in my django
project. Now I need to add a shop login for resellers. Can some one provide
me the process to add Shop-Dashboard in NLP like in non coding format just
to give me idea how to go for it.

Do I need to build form from my Shop models and then present it in view and
that's it?
Kindly give me benefit out of your experience that what are the
considerations I should work with.

Regards,
Ali

-- 
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/CAAXvsYki_z_S52fNQRvnB4_1cbkJG%2BzDTAsxH-8uGRgeyBwO3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django-nose and errors on the admin

2016-08-20 Thread Karim
Hello everyone, I have an admin.py that I "promote" as a package splitting
the original admin.py

The file app/admin/__init__.py import all the splitted files.

Everything works. The admin works. The default testrunner works, but we use
nose and django-nose at their last version and I have exceptions on
register and unregister model admins.

We are using django 1.7.7 planning the update soon could be this the
problem?

The error I'm facing is the same issued on this article:

https://www.peterbe.com/plog/cryptic-errors-when-using-django-nose

Any idea?

-- 
Karim N. Gorjux

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


Non Admin Dashboard/Shop Login for Suppliers

2016-08-20 Thread Shazia Nusrat
Hi,

I am using Django-registration for registration process in my django
project. Now I need to add a shop login for resellers. Can some one provide
me the process to add Shop-Dashboard in NLP like in non coding format just
to give me idea how to go for it.

Do I need to build form from my Shop models and then present it in view and
that's it?
Kindly give me benefit out of your experience that what are the
considerations I should work with.

Regards,
Shazia

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


Django-drip not working

2016-08-20 Thread M Hashmi
Hi Guys,

I am having trouble with Django-drip and couldn't search a solution and
hard to figure out. The error pops up when I try to add a Drip. My
settings.py has "DRIP_FROM_MAIL" field and EMAIL_HOST field both. I've
added django-drip and migrated for django==1.8.13 it worked fine but now
stuck at "get_fields" error.

Following is the traceback:

Traceback:
File
"C:\Users\Mudassar\dressikarepo\lib\site-packages\django\core\handlers\base.py"
in get_response
  132. response = wrapped_callback(request,
*callback_args, **callback_kwargs)
File
"C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\options.py"
in wrapper
  616. return self.admin_site.admin_view(view)(*args,
**kwargs)
File
"C:\Users\Mudassar\dressikarepo\lib\site-packages\django\utils\decorators.py"
in _wrapped_view
  110. response = view_func(request, *args, **kwargs)
File
"C:\Users\Mudassar\dressikarepo\lib\site-packages\django\views\decorators\cache.py"
in _wrapped_view_func
  57. response = view_func(request, *args, **kwargs)
File
"C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\sites.py"
in inner
  233. return view(request, *args, **kwargs)
File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in
add_view
  83. request,
extra_context=self.build_extra_context(extra_context))
File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in
build_extra_context
  78. extra_context['field_data'] =
json.dumps(get_simple_fields(User))
File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in
get_simple_fields
  118. return [[f[0], f[3].__name__] for f in get_fields(Model,
**kwargs)]
File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in
get_fields
  48. fields = Model._meta.fields + Model._meta.many_to_many +
Model._meta.get_all_related_objects()

Exception Type: TypeError at /admin/drip/drip/add/
Exception Value: can only concatenate tuple (not "list") to tuple

I've also searched issues opened in past with "
https://github.com/zapier/django-drip/issues"; and was able to solve few
problems but can't solve this one.Please advise.

-- 
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/CANoUts67b%2B6uKZ4BcNqBZ-rv9zLy4DV7b-Ck4OSU5XWJ2uY_NA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-drip not working

2016-08-20 Thread Tim Graham
Looks like it could be a bug in django-drip because:

Model._meta.fields + Model._meta.many_to_many + 
Model._meta.get_all_related_objects()
(tuple) + (tuple) + (list)

A possible fix could be: ... + tuple(Model._meta.get_all_related_objects())

On Saturday, August 20, 2016 at 7:56:46 AM UTC-4, M Hashmi wrote:
>
> Hi Guys,
>
> I am having trouble with Django-drip and couldn't search a solution and 
> hard to figure out. The error pops up when I try to add a Drip. My 
> settings.py has "DRIP_FROM_MAIL" field and EMAIL_HOST field both. I've 
> added django-drip and migrated for django==1.8.13 it worked fine but now 
> stuck at "get_fields" error.
>
> Following is the traceback:
>
> Traceback:
> File 
> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\core\handlers\base.py"
>  
> in get_response
>   132. response = wrapped_callback(request, 
> *callback_args, **callback_kwargs)
> File 
> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\options.py"
>  
> in wrapper
>   616. return self.admin_site.admin_view(view)(*args, 
> **kwargs)
> File 
> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\utils\decorators.py" 
> in _wrapped_view
>   110. response = view_func(request, *args, **kwargs)
> File 
> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\views\decorators\cache.py"
>  
> in _wrapped_view_func
>   57. response = view_func(request, *args, **kwargs)
> File 
> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\sites.py"
>  
> in inner
>   233. return view(request, *args, **kwargs)
> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in 
> add_view
>   83. request, 
> extra_context=self.build_extra_context(extra_context))
> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in 
> build_extra_context
>   78. extra_context['field_data'] = 
> json.dumps(get_simple_fields(User))
> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in 
> get_simple_fields
>   118. return [[f[0], f[3].__name__] for f in get_fields(Model, 
> **kwargs)]
> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in 
> get_fields
>   48. fields = Model._meta.fields + Model._meta.many_to_many + 
> Model._meta.get_all_related_objects()
>
> Exception Type: TypeError at /admin/drip/drip/add/
> Exception Value: can only concatenate tuple (not "list") to tuple
>
> I've also searched issues opened in past with "
> https://github.com/zapier/django-drip/issues"; and was able to solve few 
> problems but can't solve this one.Please advise.
>
>

-- 
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/012f3841-5585-4cbe-95f0-18903c7fd319%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-drip not working

2016-08-20 Thread M Hashmi
Now I am getting another error:

Traceback:

File
"C:\Users\Mudassar\dressikarepo\lib\site-packages\django\core\handlers\base.py"
in get_response

  132. response = wrapped_callback(request,
*callback_args, **callback_kwargs)

File
"C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\options.py"
in wrapper

  616. return self.admin_site.admin_view(view)(*args,
**kwargs)

File
"C:\Users\Mudassar\dressikarepo\lib\site-packages\django\utils\decorators.py"
in _wrapped_view

  110. response = view_func(request, *args, **kwargs)

File
"C:\Users\Mudassar\dressikarepo\lib\site-packages\django\views\decorators\cache.py"
in _wrapped_view_func

  57. response = view_func(request, *args, **kwargs)

File
"C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\sites.py"
in inner

  233. return view(request, *args, **kwargs)

File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in
add_view

  83. request,
extra_context=self.build_extra_context(extra_context))

File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in
build_extra_context

  78. extra_context['field_data'] =
json.dumps(get_simple_fields(User))

File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in
get_simple_fields

  118. return [[f[0], f[3].__name__] for f in get_fields(Model,
**kwargs)]

File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in
get_fields

  95. RelModel = field.related.parent_model


Exception Type: AttributeError at /admin/drip/drip/add/

Exception Value: 'ManyToManyRel' object has no attribute 'parent_model'

However at line 95 "RelModel = field.related.*parent_model*" is referencing
to following:

patent_model{InlineModelAdmin in}
patent_model{InlineModelAdmin in django.contrib.admin.options}
patent_model{InlineModelAdmin in django_common.admin}

Regards,
Mudassar

On Sat, Aug 20, 2016 at 5:52 AM, Tim Graham  wrote:

> Looks like it could be a bug in django-drip because:
>
> Model._meta.fields + Model._meta.many_to_many +
> Model._meta.get_all_related_objects()
> (tuple) + (tuple) + (list)
>
> A possible fix could be: ... + tuple(Model._meta.get_all_
> related_objects())
>
>
> On Saturday, August 20, 2016 at 7:56:46 AM UTC-4, M Hashmi wrote:
>>
>> Hi Guys,
>>
>> I am having trouble with Django-drip and couldn't search a solution and
>> hard to figure out. The error pops up when I try to add a Drip. My
>> settings.py has "DRIP_FROM_MAIL" field and EMAIL_HOST field both. I've
>> added django-drip and migrated for django==1.8.13 it worked fine but now
>> stuck at "get_fields" error.
>>
>> Following is the traceback:
>>
>> Traceback:
>> File 
>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\core\handlers\base.py"
>> in get_response
>>   132. response = wrapped_callback(request,
>> *callback_args, **callback_kwargs)
>> File 
>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\options.py"
>> in wrapper
>>   616. return self.admin_site.admin_view(view)(*args,
>> **kwargs)
>> File 
>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\utils\decorators.py"
>> in _wrapped_view
>>   110. response = view_func(request, *args, **kwargs)
>> File 
>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\views\decorators\cache.py"
>> in _wrapped_view_func
>>   57. response = view_func(request, *args, **kwargs)
>> File 
>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\sites.py"
>> in inner
>>   233. return view(request, *args, **kwargs)
>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in
>> add_view
>>   83. request, extra_context=self.build_extra
>> _context(extra_context))
>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in
>> build_extra_context
>>   78. extra_context['field_data'] = json.dumps(get_simple_fields(U
>> ser))
>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in
>> get_simple_fields
>>   118. return [[f[0], f[3].__name__] for f in get_fields(Model,
>> **kwargs)]
>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in
>> get_fields
>>   48. fields = Model._meta.fields + Model._meta.many_to_many +
>> Model._meta.get_all_related_objects()
>>
>> Exception Type: TypeError at /admin/drip/drip/add/
>> Exception Value: can only concatenate tuple (not "list") to tuple
>>
>> I've also searched issues opened in past with "
>> https://github.com/zapier/django-drip/issues"; and was able to solve few
>> problems but can't solve this one.Please advise.
>>
>> --
> 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

How can I capture two slugs in one URL pattern?

2016-08-20 Thread Yunus
Hello,

I want to two slugs in one URL pattern. These slugs from different models. 
I have a model Link with a many to one relationship with a model category.

Actually these two slugs is working. But one of the slugs is accepting 
whatever I write in the category_slug section of the url.

Let's say: I write 
127.0.0.1:8000/there_is_no_name_like_that_in_the_database/pk/slug this. 
I am going to this page but there is no category with this name. So, 
basically is accepting whatever I write. 
*#links/views.py*
class LinkDetailView(FormMixin, DetailView):
model = Link
context_object_name = 'link'
form_class = CommentForm
success_url = reverse_lazy('home')


def get_object(self, queryset=None):
return get_object_or_404(Link, pk=self.kwargs['pk'], slug=self.
kwargs['slug'])


...

*#links/urls.py*
urlpatterns = [


... 
   
url(
regex=r
'^k/(?P[\w-]+)/(?P\d+)(?:/(?P[\w\d-]+))?/$',
view=views.LinkDetailView.as_view(),
name='link_detail'
),


...
]

-- 
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/0b8482ee-5e64-4ee8-a664-d1d938767bd6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-drip not working

2016-08-20 Thread Simon Charette
It looks like django-drip has not been ported to Django 1.8 yet.

Le samedi 20 août 2016 09:41:06 UTC-4, M Hashmi a écrit :
>
> Now I am getting another error:
>
> Traceback:
>
> File 
> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\core\handlers\base.py"
>  
> in get_response
>
>   132. response = wrapped_callback(request, 
> *callback_args, **callback_kwargs)
>
> File 
> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\options.py"
>  
> in wrapper
>
>   616. return self.admin_site.admin_view(view)(*args, 
> **kwargs)
>
> File 
> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\utils\decorators.py" 
> in _wrapped_view
>
>   110. response = view_func(request, *args, **kwargs)
>
> File 
> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\views\decorators\cache.py"
>  
> in _wrapped_view_func
>
>   57. response = view_func(request, *args, **kwargs)
>
> File 
> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\sites.py"
>  
> in inner
>
>   233. return view(request, *args, **kwargs)
>
> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in 
> add_view
>
>   83. request, 
> extra_context=self.build_extra_context(extra_context))
>
> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in 
> build_extra_context
>
>   78. extra_context['field_data'] = 
> json.dumps(get_simple_fields(User))
>
> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in 
> get_simple_fields
>
>   118. return [[f[0], f[3].__name__] for f in get_fields(Model, 
> **kwargs)]
>
> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in 
> get_fields
>
>   95. RelModel = field.related.parent_model
>
>
> Exception Type: AttributeError at /admin/drip/drip/add/
>
> Exception Value: 'ManyToManyRel' object has no attribute 'parent_model'
>
> However at line 95 "RelModel = field.related.*parent_model*" is 
> referencing to following:
>
> patent_model{InlineModelAdmin in}
> patent_model{InlineModelAdmin in django.contrib.admin.options}
> patent_model{InlineModelAdmin in django_common.admin}
>
> Regards,
> Mudassar
>
> On Sat, Aug 20, 2016 at 5:52 AM, Tim Graham  > wrote:
>
>> Looks like it could be a bug in django-drip because:
>>
>> Model._meta.fields + Model._meta.many_to_many + 
>> Model._meta.get_all_related_objects()
>> (tuple) + (tuple) + (list)
>>
>> A possible fix could be: ... + 
>> tuple(Model._meta.get_all_related_objects())
>>
>>
>> On Saturday, August 20, 2016 at 7:56:46 AM UTC-4, M Hashmi wrote:
>>>
>>> Hi Guys,
>>>
>>> I am having trouble with Django-drip and couldn't search a solution and 
>>> hard to figure out. The error pops up when I try to add a Drip. My 
>>> settings.py has "DRIP_FROM_MAIL" field and EMAIL_HOST field both. I've 
>>> added django-drip and migrated for django==1.8.13 it worked fine but now 
>>> stuck at "get_fields" error.
>>>
>>> Following is the traceback:
>>>
>>> Traceback:
>>> File 
>>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\core\handlers\base.py"
>>>  
>>> in get_response
>>>   132. response = wrapped_callback(request, 
>>> *callback_args, **callback_kwargs)
>>> File 
>>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\options.py"
>>>  
>>> in wrapper
>>>   616. return self.admin_site.admin_view(view)(*args, 
>>> **kwargs)
>>> File 
>>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\utils\decorators.py"
>>>  
>>> in _wrapped_view
>>>   110. response = view_func(request, *args, **kwargs)
>>> File 
>>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\views\decorators\cache.py"
>>>  
>>> in _wrapped_view_func
>>>   57. response = view_func(request, *args, **kwargs)
>>> File 
>>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\sites.py"
>>>  
>>> in inner
>>>   233. return view(request, *args, **kwargs)
>>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in 
>>> add_view
>>>   83. request, 
>>> extra_context=self.build_extra_context(extra_context))
>>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in 
>>> build_extra_context
>>>   78. extra_context['field_data'] = 
>>> json.dumps(get_simple_fields(User))
>>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in 
>>> get_simple_fields
>>>   118. return [[f[0], f[3].__name__] for f in get_fields(Model, 
>>> **kwargs)]
>>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in 
>>> get_fields
>>>   48. fields = Model._meta.fields + Model._meta.many_to_many + 
>>> Model._meta.get_all_related_objects()
>>>
>>> Exception Type: TypeError at /admin/drip/drip/add/
>>> Exception Value: can only concatenate tuple (not "list") to tuple
>>>
>>> I've also searc

Re: New to Django

2016-08-20 Thread Wolf Painter
If you look at the code for the template, images is in there. I've tried 
all the ways I found to display my multidimensional dictionary, one of 
which is to loop through the first part, then the second. If you look at 
the code below, I'm looping through the first part of the dictionary, then 
the second by calling the value on child_list.items which is images. So 
far, nothing I've tried is working no matter how I loop through it in the 
template. I'm still stuck on this as nothing I have looked up has worked, 
but I am new to django, so there may be something I'm missing.:

{% for server, images in child_list.items %}
{{ server }}
{% for image, number in images.items %}
{{ number }}
{% endfor %}
{% endfor %}


On Thursday, August 18, 2016 at 6:33:58 AM UTC-7, Derek wrote:
>
> In your view you have:
>
> context = {
> "server_list": serverlist,
> "image_list": imagelist,
> "child_list": childimagelist
> }
> 
> So the variables being passed through to your template are named: 
> server_list, image_list, child_list.
>
> In your template you call this:
>
> for server, images in child_list.items
>  
> Which is fine, but then you call this:
>
> for image, number in images.items
>
> But there is no variable called "images" I think it should be 
> "image_list:.
>
> HTH
> Derek
>
>
> On Tuesday, 16 August 2016 02:22:28 UTC+2, Wolf Painter wrote:
>>
>> Hey everyone, I didn't see any posts (or google search) that could 
>> possibly answer my question, so I am here... I'm trying to create a way to 
>> launch vm's on a Xen or VMWare server using a website. I have the python 
>> file written on the Server and am currently creating a DJango app to manage 
>> everything. I'm stuck in a big way. I  currently have models that track 
>> servers, images and child images launched from the parent, but I can't 
>> figure out how to display it properly in a template so i can update the 
>> count (either add or subtract a number of VM's from a server). I'm new to 
>> both Django and Python, so please excuse any ignorance here... Here are my 
>> relevant models:
>>
>> class Image(models.Model):
>> name = models.CharField(verbose_name='Image Name', max_length=50)
>> labID = models.ManyToManyField(Lab, blank=True, related_name='labID')
>> type = models.CharField(max_length=50)
>>
>> def __str__(self):
>> return self.name
>>
>>
>> class Server(models.Model):
>> name = models.CharField(verbose_name='Server Name', max_length=50)
>> ipAddress = models.CharField(max_length=15)
>> maxCCU = models.IntegerField(default=0)
>> images = models.ManyToManyField(Image, blank=True, 
>> related_name='baseImage')
>>
>> def __str__(self):
>> return self.ipAddress
>>
>> class Childimage(models.Model):
>> name = models.CharField(verbose_name='Child Image Name', max_length=50)
>> parent = models.ForeignKey(Image, related_name='base')
>> server = models.ForeignKey(Server, related_name='server')
>> inUse = models.BooleanField()
>> rdpportnum = models.CharField(max_length=4)
>>
>> def __str__(self):
>> return self.name
>>
>> What I'm trying to do is have a web page that displays the number of parent 
>> images on a server by counting the child image. For example, I have a parent 
>> image called win2k12_excel and there are 12 child images of the parent 
>> win2k12_excel on the x.x.x.x server. I would like a web page that shows 
>> there are 12 win2k12_excel images on that server that would allow me to add 
>> or subtract the number on that server.
>>
>>
>> I have created a view that does this and puts it into a multidimensional 
>> dictionary, but I cannot figure out how to get that to render properly in a 
>> template. Here is my view:
>>
>>
>> def servers(request):
>> serverlist = Server.objects.all()
>> imagelist = Image.objects.filter(baseImage__in=serverlist).distinct()
>>
>> childimagelist = defaultdict(list)
>> for server in serverlist:
>> for image in imagelist:
>> number = 
>> Childimage.objects.filter(parent__name__contains=image).filter(server__ipAddress__contains=server).count()
>> childimagelist[server].append({image: number})
>> childimagelist.default_factory = None
>> context = {
>> "server_list": serverlist,
>> "image_list": imagelist,
>> "child_list": childimagelist
>> }
>> return render(request, "administration/servers.html", context)
>>
>> No matter what I have tried so far, I cannot get this dictionary to render 
>> in a template. Is there a better way to do what I'm trying to do? Is there a 
>> proper way to get the dictionary parsed in the template? Any help would be 
>> appreciated. 
>>
>>
>> Oh, and I have search Google for weeks and tried all the suggestions I 
>> found. None of them worked. I can get the first part of the dictionary 
>> parsed, but no further than that. Here is the template cod

Re: New to Django

2016-08-20 Thread Sergiy Khohlov
I've created project for managing virtual machines via libvirt using django
few years ago. Also you can take a look at ganeti project. I'm ready to
answer any question related to django and cloud computing.

Thanks, Serge

20 серп. 2016 20:23 "Wolf Painter"  пише:

> If you look at the code for the template, images is in there. I've tried
> all the ways I found to display my multidimensional dictionary, one of
> which is to loop through the first part, then the second. If you look at
> the code below, I'm looping through the first part of the dictionary, then
> the second by calling the value on child_list.items which is images. So
> far, nothing I've tried is working no matter how I loop through it in the
> template. I'm still stuck on this as nothing I have looked up has worked,
> but I am new to django, so there may be something I'm missing.:
>
> {% for server, images in child_list.items %}
> {{ server }}
> {% for image, number in images.items %}
> {{ number }}
> {% endfor %}
> {% endfor %}
>
>
> On Thursday, August 18, 2016 at 6:33:58 AM UTC-7, Derek wrote:
>>
>> In your view you have:
>>
>> context = {
>> "server_list": serverlist,
>> "image_list": imagelist,
>> "child_list": childimagelist
>> }
>>
>> So the variables being passed through to your template are named:
>> server_list, image_list, child_list.
>>
>> In your template you call this:
>>
>> for server, images in child_list.items
>>
>> Which is fine, but then you call this:
>>
>> for image, number in images.items
>>
>> But there is no variable called "images" I think it should be
>> "image_list:.
>>
>> HTH
>> Derek
>>
>>
>> On Tuesday, 16 August 2016 02:22:28 UTC+2, Wolf Painter wrote:
>>>
>>> Hey everyone, I didn't see any posts (or google search) that could
>>> possibly answer my question, so I am here... I'm trying to create a way to
>>> launch vm's on a Xen or VMWare server using a website. I have the python
>>> file written on the Server and am currently creating a DJango app to manage
>>> everything. I'm stuck in a big way. I  currently have models that track
>>> servers, images and child images launched from the parent, but I can't
>>> figure out how to display it properly in a template so i can update the
>>> count (either add or subtract a number of VM's from a server). I'm new to
>>> both Django and Python, so please excuse any ignorance here... Here are my
>>> relevant models:
>>>
>>> class Image(models.Model):
>>> name = models.CharField(verbose_name='Image Name', max_length=50)
>>> labID = models.ManyToManyField(Lab, blank=True, related_name='labID')
>>> type = models.CharField(max_length=50)
>>>
>>> def __str__(self):
>>> return self.name
>>>
>>>
>>> class Server(models.Model):
>>> name = models.CharField(verbose_name='Server Name', max_length=50)
>>> ipAddress = models.CharField(max_length=15)
>>> maxCCU = models.IntegerField(default=0)
>>> images = models.ManyToManyField(Image, blank=True, 
>>> related_name='baseImage')
>>>
>>> def __str__(self):
>>> return self.ipAddress
>>>
>>> class Childimage(models.Model):
>>> name = models.CharField(verbose_name='Child Image Name', max_length=50)
>>> parent = models.ForeignKey(Image, related_name='base')
>>> server = models.ForeignKey(Server, related_name='server')
>>> inUse = models.BooleanField()
>>> rdpportnum = models.CharField(max_length=4)
>>>
>>> def __str__(self):
>>> return self.name
>>>
>>> What I'm trying to do is have a web page that displays the number of parent 
>>> images on a server by counting the child image. For example, I have a 
>>> parent image called win2k12_excel and there are 12 child images of the 
>>> parent win2k12_excel on the x.x.x.x server. I would like a web page that 
>>> shows there are 12 win2k12_excel images on that server that would allow me 
>>> to add or subtract the number on that server.
>>>
>>>
>>> I have created a view that does this and puts it into a multidimensional 
>>> dictionary, but I cannot figure out how to get that to render properly in a 
>>> template. Here is my view:
>>>
>>>
>>> def servers(request):
>>> serverlist = Server.objects.all()
>>> imagelist = Image.objects.filter(baseImage__in=serverlist).distinct()
>>>
>>> childimagelist = defaultdict(list)
>>> for server in serverlist:
>>> for image in imagelist:
>>> number = 
>>> Childimage.objects.filter(parent__name__contains=image).filter(server__ipAddress__contains=server).count()
>>> childimagelist[server].append({image: number})
>>> childimagelist.default_factory = None
>>> context = {
>>> "server_list": serverlist,
>>> "image_list": imagelist,
>>> "child_list": childimagelist
>>> }
>>> return render(request, "administration/servers.html", context)
>>>
>>> No matter what I have tried so far, I cannot get this dictionary to render 
>>> in a template. 

Re: Django-drip not working

2016-08-20 Thread M Hashmi
Yeah I know that but I thought it would be easy to get it ported manually
but after reading code twice I guess I can wait till owner of repo do so.
Thanks for help.

Regards,
Mudassar

On Sat, Aug 20, 2016 at 9:15 AM, Simon Charette 
wrote:

> It looks like django-drip has not been ported to Django 1.8 yet.
>
>
> Le samedi 20 août 2016 09:41:06 UTC-4, M Hashmi a écrit :
>
>> Now I am getting another error:
>>
>> Traceback:
>>
>> File 
>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\core\handlers\base.py"
>> in get_response
>>
>>   132. response = wrapped_callback(request,
>> *callback_args, **callback_kwargs)
>>
>> File 
>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\options.py"
>> in wrapper
>>
>>   616. return self.admin_site.admin_view(view)(*args,
>> **kwargs)
>>
>> File 
>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\utils\decorators.py"
>> in _wrapped_view
>>
>>   110. response = view_func(request, *args, **kwargs)
>>
>> File 
>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\views\decorators\cache.py"
>> in _wrapped_view_func
>>
>>   57. response = view_func(request, *args, **kwargs)
>>
>> File 
>> "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\sites.py"
>> in inner
>>
>>   233. return view(request, *args, **kwargs)
>>
>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in
>> add_view
>>
>>   83. request, extra_context=self.build_extra
>> _context(extra_context))
>>
>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py" in
>> build_extra_context
>>
>>   78. extra_context['field_data'] = json.dumps(get_simple_fields(U
>> ser))
>>
>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in
>> get_simple_fields
>>
>>   118. return [[f[0], f[3].__name__] for f in get_fields(Model,
>> **kwargs)]
>>
>> File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py" in
>> get_fields
>>
>>   95. RelModel = field.related.parent_model
>>
>>
>> Exception Type: AttributeError at /admin/drip/drip/add/
>>
>> Exception Value: 'ManyToManyRel' object has no attribute 'parent_model'
>>
>> However at line 95 "RelModel = field.related.*parent_model*" is
>> referencing to following:
>>
>> patent_model{InlineModelAdmin in}
>> patent_model{InlineModelAdmin in django.contrib.admin.options}
>> patent_model{InlineModelAdmin in django_common.admin}
>>
>> Regards,
>> Mudassar
>>
>> On Sat, Aug 20, 2016 at 5:52 AM, Tim Graham  wrote:
>>
>>> Looks like it could be a bug in django-drip because:
>>>
>>> Model._meta.fields + Model._meta.many_to_many +
>>> Model._meta.get_all_related_objects()
>>> (tuple) + (tuple) + (list)
>>>
>>> A possible fix could be: ... + tuple(Model._meta.get_all_rela
>>> ted_objects())
>>>
>>>
>>> On Saturday, August 20, 2016 at 7:56:46 AM UTC-4, M Hashmi wrote:

 Hi Guys,

 I am having trouble with Django-drip and couldn't search a solution and
 hard to figure out. The error pops up when I try to add a Drip. My
 settings.py has "DRIP_FROM_MAIL" field and EMAIL_HOST field both. I've
 added django-drip and migrated for django==1.8.13 it worked fine but now
 stuck at "get_fields" error.

 Following is the traceback:

 Traceback:
 File 
 "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\core\handlers\base.py"
 in get_response
   132. response = wrapped_callback(request,
 *callback_args, **callback_kwargs)
 File 
 "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\options.py"
 in wrapper
   616. return self.admin_site.admin_view(view)(*args,
 **kwargs)
 File 
 "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\utils\decorators.py"
 in _wrapped_view
   110. response = view_func(request, *args,
 **kwargs)
 File 
 "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\views\decorators\cache.py"
 in _wrapped_view_func
   57. response = view_func(request, *args, **kwargs)
 File 
 "C:\Users\Mudassar\dressikarepo\lib\site-packages\django\contrib\admin\sites.py"
 in inner
   233. return view(request, *args, **kwargs)
 File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py"
 in add_view
   83. request, extra_context=self.build_extra
 _context(extra_context))
 File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\admin.py"
 in build_extra_context
   78. extra_context['field_data'] =
 json.dumps(get_simple_fields(User))
 File "C:\Users\Mudassar\dressikarepo\lib\site-packages\drip\utils.py"
 in get_simple_fields
   118. return [[f[0], f[3].__name__] for f in get_fields(Model,
 **kwargs)]
 File "C:\Users\Mudassar\dressikarepo

Re: New to Django

2016-08-20 Thread Andrew Beales
This works for me:

{% for server, images in child_list.items %}
{{ server }}
{% for image in images %}
  {% for key,val in image.items %}
  {{ key }}: {{ val }}
  {% endfor %}
{% endfor %}
{% endfor %}

In your template, 'image' is a list of dicts, so you need to loop over that 
to get at them.


On Tuesday, August 16, 2016 at 1:22:28 AM UTC+1, Wolf Painter wrote:
>
> Hey everyone, I didn't see any posts (or google search) that could 
> possibly answer my question, so I am here... I'm trying to create a way to 
> launch vm's on a Xen or VMWare server using a website. I have the python 
> file written on the Server and am currently creating a DJango app to manage 
> everything. I'm stuck in a big way. I  currently have models that track 
> servers, images and child images launched from the parent, but I can't 
> figure out how to display it properly in a template so i can update the 
> count (either add or subtract a number of VM's from a server). I'm new to 
> both Django and Python, so please excuse any ignorance here... Here are my 
> relevant models:
>
> class Image(models.Model):
> name = models.CharField(verbose_name='Image Name', max_length=50)
> labID = models.ManyToManyField(Lab, blank=True, related_name='labID')
> type = models.CharField(max_length=50)
>
> def __str__(self):
> return self.name
>
>
> class Server(models.Model):
> name = models.CharField(verbose_name='Server Name', max_length=50)
> ipAddress = models.CharField(max_length=15)
> maxCCU = models.IntegerField(default=0)
> images = models.ManyToManyField(Image, blank=True, 
> related_name='baseImage')
>
> def __str__(self):
> return self.ipAddress
>
> class Childimage(models.Model):
> name = models.CharField(verbose_name='Child Image Name', max_length=50)
> parent = models.ForeignKey(Image, related_name='base')
> server = models.ForeignKey(Server, related_name='server')
> inUse = models.BooleanField()
> rdpportnum = models.CharField(max_length=4)
>
> def __str__(self):
> return self.name
>
> What I'm trying to do is have a web page that displays the number of parent 
> images on a server by counting the child image. For example, I have a parent 
> image called win2k12_excel and there are 12 child images of the parent 
> win2k12_excel on the x.x.x.x server. I would like a web page that shows there 
> are 12 win2k12_excel images on that server that would allow me to add or 
> subtract the number on that server.
>
>
> I have created a view that does this and puts it into a multidimensional 
> dictionary, but I cannot figure out how to get that to render properly in a 
> template. Here is my view:
>
>
> def servers(request):
> serverlist = Server.objects.all()
> imagelist = Image.objects.filter(baseImage__in=serverlist).distinct()
>
> childimagelist = defaultdict(list)
> for server in serverlist:
> for image in imagelist:
> number = 
> Childimage.objects.filter(parent__name__contains=image).filter(server__ipAddress__contains=server).count()
> childimagelist[server].append({image: number})
> childimagelist.default_factory = None
> context = {
> "server_list": serverlist,
> "image_list": imagelist,
> "child_list": childimagelist
> }
> return render(request, "administration/servers.html", context)
>
> No matter what I have tried so far, I cannot get this dictionary to render in 
> a template. Is there a better way to do what I'm trying to do? Is there a 
> proper way to get the dictionary parsed in the template? Any help would be 
> appreciated. 
>
>
> Oh, and I have search Google for weeks and tried all the suggestions I found. 
> None of them worked. I can get the first part of the dictionary parsed, but 
> no further than that. Here is the template code (server works, but for image, 
> number in images.items, does not):
>
>
> {% for server, images in child_list.items %}
> {{ server }}
> {% for image, number in images.items %}
> {{ number }}
> {% endfor %}
> {% endfor %}
>
>
>
> Any help at all would be appreciated...
>
>
> Thanks,
>
> Wolf
>
>

-- 
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/f994cec1-9bb0-4bbb-a928-f75080169e64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New to Django

2016-08-20 Thread Wolf Painter
OMG THANK YOU!! This totally works! Thank you, Thank you, Thank you!

On Saturday, August 20, 2016 at 12:30:26 PM UTC-7, Andrew Beales wrote:
>
> This works for me:
>
> {% for server, images in child_list.items %}
> {{ server }}
> {% for image in images %}
>   {% for key,val in image.items %}
>   {{ key }}: {{ val }}
>   {% endfor %}
> {% endfor %}
> {% endfor %}
>
> In your template, 'image' is a list of dicts, so you need to loop over 
> that to get at them.
>
>
>
>

-- 
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/2a5dea43-e5f9-4da8-87b6-1b4d9f31289f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New to Django

2016-08-20 Thread Wolf Painter
Hi Serge, I would love to speak to you about your app and how you use it. 
I'm new to django, so this has taken a bit to get used to but I really 
think it's the way to go for what I want to do with it. What's the best way 
to reach you?

On Saturday, August 20, 2016 at 11:29:02 AM UTC-7, Sergiy Khohlov wrote:
>
> I've created project for managing virtual machines via libvirt using 
> django few years ago. Also you can take a look at ganeti project. I'm ready 
> to answer any question related to django and cloud computing.
>
> Thanks, Serge
>
>
> -- 
>> 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/d855fdde-6a52-48d9-9a87-02beadf59be7%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/af6e1382-91da-4a41-b68e-705884749d3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.