Re: Saving Data in Multiple Selected Checkbox for Voting System

2017-02-10 Thread Genaro Lubong
please help me guys

On Feb 8, 2017 12:33 AM, "Genaro Lubong"  wrote:

Hello, newbie here, I am currently making our capstone project as a
requirement to our course subject, and it is a major subject, while I was
in the part of retreiving the selected candidates, I was not about to
iterate the vote for those selected on the upper part, just the last
selected item/object/candidate, and since it is the major objective of our
project, and I am stucked with it and our team will be screwed if I didn't
finished it As Soon As Possible, here are my codes:


#views.py

def vote(request):
 selected_candidate = Candidate.objects.get(pk=reque
st.POST.get('candidate'))
 selected_candidate.totalvotes += 1
  selected_candidate.save()
  return redirect('vs:index')

#voting.html

{% if all_candidates %}
 
 {% csrf_token %}
 {% for organization in all_organizations %}
 {% if all_positions %}
 {{ organization.organization }}
 {% for position in all_positions %}
 {% if organization == position.organization %}
 {{ position.position }}
 
 {% for candidate in all_candidates %}
 {% if position == candidate.position %}
 
 
 
 
 
 
 
 
 
 
  
 {{
candidate.studentid.firstname }} {{ candidate.studentid.middlename }} {{
candidate.studentid.lastname }} {{ candidate.studentid.suffix }}
 {{
candidate.position }} - {{ candidate.party }}
 
 
 
 {% endif %}
 {% endfor %}
 
 {% endif %}
 {% endfor %}
 {% endif %}
 {% endfor %}
 
 
 
  
 {% else %}
 No Candidates Yet {% endif %}

#models.py

class Candidate(models.Model):
studentid = models.OneToOneField(Student, on_delete=models.CASCADE)
position = models.ForeignKey(Position, on_delete=models.CASCADE)
party = models.ForeignKey(Party, on_delete=models.CASCADE)
picture = models.ImageField()
totalvotes = models.IntegerField(default=0)
casvotes = models.IntegerField(default=0)
citvotes = models.IntegerField(default=0)
coevotes = models.IntegerField(default=0)
ctevotes = models.IntegerField(default=0)


I hope, you can help me guys, thank you so much in advance.

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


Can't use psycopg2 2.7b1 with django

2017-02-10 Thread notsqrt
Hi !

psycopg2 is preparing a new release, and currently the git project uses PEP 
440 -compatible version numbers 
: 2.7b1,  2.7b2.dev0 (see 
https://github.com/psycopg/psycopg2/blob/master/setup.py#L67) 

In 
https://github.com/django/django/blob/master/django/db/backends/postgresql/base.py,
 
django parses that version string to check if it is greater than 2.4.5.

But the psycopg2_version function can't handle version strings like 2.7b1, 
and returns (2,).

Any ideas to improve django ?

The "packaging" package could be used for that 
: https://packaging.pypa.io/en/latest/version/, a correct version parser 
does not seem simple !
Or "from distutils.version import LooseVersion"

Thanks,
NotSqrt

-- 
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/45a7ed92-596b-40dd-badd-50579940390a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't use psycopg2 2.7b1 with django

2017-02-10 Thread notsqrt
packaging is a dependency of setuptools (previously included in its vendor 
libs), so very probably installed everywhere !

Le vendredi 10 février 2017 11:58:29 UTC+1, not...@gmail.com a écrit :
>
> Hi !
>
> psycopg2 is preparing a new release, and currently the git project uses PEP 
> 440 -compatible version 
> numbers : 2.7b1,  2.7b2.dev0 (see 
> https://github.com/psycopg/psycopg2/blob/master/setup.py#L67) 
>
> In 
> https://github.com/django/django/blob/master/django/db/backends/postgresql/base.py,
>  
> django parses that version string to check if it is greater than 2.4.5.
>
> But the psycopg2_version function can't handle version strings like 2.7b1, 
> and returns (2,).
>
> Any ideas to improve django ?
>
> The "packaging" package could be used for that : 
> https://packaging.pypa.io/en/latest/version/, a correct version parser 
> does not seem simple !
> Or "from distutils.version import LooseVersion"
>
> Thanks,
> NotSqrt
>

-- 
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/fa85bebe-c0e3-4ea2-b43b-9ecf544084f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Saving Data in Multiple Selected Checkbox for Voting System

2017-02-10 Thread ludovic coues
You didn't provide the view making use of that template

2017-02-10 10:49 GMT+01:00 Genaro Lubong :
> please help me guys
>
>
> On Feb 8, 2017 12:33 AM, "Genaro Lubong"  wrote:
>
> Hello, newbie here, I am currently making our capstone project as a
> requirement to our course subject, and it is a major subject, while I was in
> the part of retreiving the selected candidates, I was not about to iterate
> the vote for those selected on the upper part, just the last selected
> item/object/candidate, and since it is the major objective of our project,
> and I am stucked with it and our team will be screwed if I didn't finished
> it As Soon As Possible, here are my codes:
>
>
> #views.py
>
> def vote(request):
>  selected_candidate =
> Candidate.objects.get(pk=request.POST.get('candidate'))
>  selected_candidate.totalvotes += 1
>   selected_candidate.save()
>   return redirect('vs:index')
>
> #voting.html
>
> {% if all_candidates %}
>  
>  {% csrf_token %}
>  {% for organization in all_organizations %}
>  {% if all_positions %}
>  {{ organization.organization }}
>  {% for position in all_positions %}
>  {% if organization == position.organization %}
>  {{ position.position }}
>  
>  {% for candidate in all_candidates %}
>  {% if position == candidate.position %}
>  
>  
>   data-toggle="modal">
>   class="portfolio-hover">
>   class="portfolio-hover-content">
>   type="checkbox" id="candidate{{ forloop.counter }}" class="candidate{{
> position.id }} fa fa-check fa-3x"  name="candidate" value="{{ candidate.id
> }}" />
>  
>  
>  
>  
>class="portfolio-caption">
>  {{
> candidate.studentid.firstname }} {{ candidate.studentid.middlename }} {{
> candidate.studentid.lastname }} {{ candidate.studentid.suffix }}
>  {{
> candidate.position }} - {{ candidate.party }}
>  
>  
>  
>  {% endif %}
>  {% endfor %}
>  
>  {% endif %}
>  {% endfor %}
>  {% endif %}
>  {% endfor %}
>  
>  
>  
>   
>  {% else %}
>  No Candidates Yet {% endif %}
>
> #models.py
>
> class Candidate(models.Model):
> studentid = models.OneToOneField(Student, on_delete=models.CASCADE)
> position = models.ForeignKey(Position, on_delete=models.CASCADE)
> party = models.ForeignKey(Party, on_delete=models.CASCADE)
> picture = models.ImageField()
> totalvotes = models.IntegerField(default=0)
> casvotes = models.IntegerField(default=0)
> citvotes = models.IntegerField(default=0)
> coevotes = models.IntegerField(default=0)
> ctevotes = models.IntegerField(default=0)
>
>
> I hope, you can help me guys, thank you so much in advance.
>
>
> --
> 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/CACY%3DutG8KLSZLYdpHpijg1QcY%3Dd0XP1DYoy8f-i_iNZwPPfi9g%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

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


Re: No installed app with label 'province'.

2017-02-10 Thread Gerald Brown


On Thursday, February 9, 2017 at 9:16:48 PM UTC+8, Florian Schweikert wrote:
>
> On 09/02/17 14:01, Gerald Brown wrote: 
> > Because of this problem I am NOT able to proceed with my project so any 
> > and all help will be appreciated. 
>
> Maybe somebody could help you if you provide more information about what 
> you are doing. 
>
> Following information could give some starting points for investigating 
> the problem: 
> * What does you INSTALLED_APPS look like? 
>

Here is the INSTALLED_APPS: "INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#'django.contrib.sites',
 'sumedrec',
]"
 

> * The code of your ModelAdmin wogether with where you trying to register 
> it. (including imports) 
>
Here is the admin.py: "from django.contrib import admin
from .models import Patient, Visits

# Register your models here.

mymodels = [ Patient, Visits]
admin.site.register(mymodels)"

 

> * Are your models working correctly? Did creating migrations and 
> applying them work? YES
>
> -- 
> regards, 
> Florian 
>

Is there anything else that I can provide to you to help solve this problem?

Thanks,
Gerald 

-- 
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/a90bcdf3-a343-4cd9-abe6-21bc4387bcaa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How install Django in PyCharm Community edition?

2017-02-10 Thread Stefan Milutinovic
You can't install django in PyCharm.

You must set proper Python interpreter into PyCharm Settings.
File>Settings>Project:name_of_your_project>Project Interpreter
There you must setup proper Python interpreter.

The best option is that you create Virtual Environment for each project.
This is guide for virtualenvironment.
http://docs.python-guide.org/en/latest/dev/virtualenvs/

Than in your virtualenv. you install all desired packages and you set that 
is your project interpreter python located in environment folder.

Good luck.

петак, 10. фебруар 2017. 00.05.12 UTC+1, Sławomir Gontarek је написао/ла:
>
> How install Django in PyCharm Community edition?
>
>

-- 
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/8e8a7691-61ad-427c-a2f7-ecd24bae17ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How install Django in PyCharm Community edition?

2017-02-10 Thread Dan Tagg
+1 for virtualenv

On 10 February 2017 at 11:44, Stefan Milutinovic 
wrote:

> You can't install django in PyCharm.
>
> You must set proper Python interpreter into PyCharm Settings.
> File>Settings>Project:name_of_your_project>Project Interpreter
> There you must setup proper Python interpreter.
>
> The best option is that you create Virtual Environment for each project.
> This is guide for virtualenvironment.
> http://docs.python-guide.org/en/latest/dev/virtualenvs/
>
> Than in your virtualenv. you install all desired packages and you set that
> is your project interpreter python located in environment folder.
>
> Good luck.
>
> петак, 10. фебруар 2017. 00.05.12 UTC+1, Sławomir Gontarek је написао/ла:
>>
>> How install Django in PyCharm Community edition?
>>
>> --
> 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/8e8a7691-61ad-427c-a2f7-ecd24bae17ea%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Wildman and Herring Limited, Registered Office: Sir Robert Peel House, 178
Bishopsgate, London, United Kingdom, EC2M 4NJ, Company no: 05766374

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


Re: Can't use psycopg2 2.7b1 with django

2017-02-10 Thread Tim Graham
I think distutils.version.LooseVersion should be safe to use (django-cms is 
using it, for example). Not sure about "packaging". Do you want to create a 
Trac ticket for this issue? Probably the same technique could also be used 
in other places.

On Friday, February 10, 2017 at 5:58:29 AM UTC-5, not...@gmail.com wrote:
>
> Hi !
>
> psycopg2 is preparing a new release, and currently the git project uses PEP 
> 440 -compatible version 
> numbers : 2.7b1,  2.7b2.dev0 (see 
> https://github.com/psycopg/psycopg2/blob/master/setup.py#L67) 
>
> In 
> https://github.com/django/django/blob/master/django/db/backends/postgresql/base.py,
>  
> django parses that version string to check if it is greater than 2.4.5.
>
> But the psycopg2_version function can't handle version strings like 2.7b1, 
> and returns (2,).
>
> Any ideas to improve django ?
>
> The "packaging" package could be used for that : 
> https://packaging.pypa.io/en/latest/version/, a correct version parser 
> does not seem simple !
> Or "from distutils.version import LooseVersion"
>
> Thanks,
> NotSqrt
>

-- 
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/78fa0a7b-dbeb-48fc-8c25-799e174c8373%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.