Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Receiving users of a group on Django
I want to collect all users of all groups of a spesific user in an object. How can I do this: from django.contrib.auth.models import User, Group user = request.user groups = user.groups.all() # ???? # #friendgroups = [] #for group in groups: # friendgroups =+ User.objects.filter(groups=group) # ???? # -
Customize context data
I have three class. The first class Perception(xwf_models.WorkflowEnabled, TimeStampedModel): loan = models.ForeignKey('loans.Loan') state = xwf_models.StateField(PerceptionWorkflow) start_date = models.DateField(_('Start date')) end_date = models.DateField(_('End date'), blank=True, null=True) current_balance = models.DecimalField(_('Current balance'), default=0, decimal_places=2, max_digits=11) operation_error = models.SmallIntegerField(_('Operation error'), default=0) notes = GenericRelation(Note) the second class PerceptionIndexView(StaffRestrictedMixin, FrontendListView): page_title = _('Perception') model = Perception template_name = 'loanwolf/perception/index.html' pjax_template_name = 'loanwolf/perception/index.pjax.html' row_actions_template_name = 'loanwolf/perception/list-actions.inc.html' url_namespace = 'perception' and the third class CustomerPerceptionIndexView(CustomerMixin, PerceptionIndexView): template_name = 'loanwolf/customers/perceptions.html' pjax_template_name = 'loanwolf/customers/perceptions.pjax.html' def get_context_data(self, **kwargs): context = super(CustomerPerceptionIndexView, self).get_context_data(**kwargs) filter_perceptions= (Perception.objects.filter(loan__request__customer__pk=self.customer.pk)) resultant = [r for r in context['results'] if r['object'] in filter_perceptions] context["resultant"] = resultant context["state"] = Perception.state #This has not solved my problem return context Actually, the context of CustomerPerceptionIndexView did not contain the attribute state. I would like to get access state attribute from Perception class in the context of CustomerPerceptionIndexView class. How could I do such thing? Thanks in advance! P.S. To be clear, I want to fix the error AttributeError: 'str' object has no attribute 'state'. I don't think I have to add 'state' like context["state"] = Perception.state. Furthermore, please let me know if I have to add something in the question. I don't have a lot of experience with Django, and your … -
subsequent ajax responses are very slow
In the all apps ajax are generally very fast,in one particular app(newly developed) for the first time also ajax response is fast but on the subsequent calls ajax response is very slow thereafter in the rest of the app's ajax responses also very slow, Is there any way to debug the issue? im saving few values in session also in the new app. any help is highly appreciated. -
How to setup 1.1 version of django?
I wanna read a book in django caled "Practical Django projects second edition", but it is outdated as the version of django used in the book was 1.1. I really wanna read this book because it really fits my needs as i working on a project with the same theme, but i have no idea how to run the examples or use django 1.1. Any suggestions? -
Django template table
I have 3 dictionaries data['d1'], data['d2'] and data['d3']. What i want is the table to look like this, getting the keys from each dictionary and presenting them like: Team 1 | Team 2 | Team 3 key 1 from d1 | key 1 from d2 | key 1 from d3 key 2 from d1 | key 2 from d2 | key 2 from d3 key 3 from d1 | key 3 from d2 | key 3 from d3 key 4 from d1 | key 4 from d2 | key 4 from d3 What i have tryed <thead> <tr> <th>Team 1</th> <th>Team 2</th> <th>Team 3</th> </tr> </thead> <tbody> <tr> {% for key, value in d1.items %} <td>{{ key }}</td> {% endfor %} </tr> <tr> {% for key, value in d2.items %} <td>{{ key }}</td> {% endfor %} </tr> <tr> {% for key, value in d3.items %} <td>{{ key }}</td> {% endfor %} </tr> </tbody> or <thead> <tr> <th>Team 1</th> <th>Team 2</th> <th>Team 3</th> </tr> </thead> <tbody> {% for key, value in d1.items %} <tr> <td>{{ key }}</td> </tr> {% endfor %} {% for key, value in d2.items %} <tr> <td>{{ key }}</td> </tr> {% endfor %} {% for key, value in … -
Send Email via AjaxCreateView with SparkPost/Gmail in Django
I tried to save a custom Form in my Django CMS Database. I need to send a Email confirmation in the Ajax Created form via SMTP / SparkPost. I am using Djano-FM to create the Ajaxviews A Custom Form works and the email is bein sent. The problem is now that i need to send a Email via Ajaxcreatview and thats how my created view looks like. class Probefahrtcreate(AjaxCreateView): form_class = ProbefahrtForm To send a email i need the function send_mail. that would look like send_mail('Using SparkPost with Django', 'This is a message from Django using SparkPost!', 'django-sparkpost@sparkpostbox.com', ['to@example.com'], fail_silently=False) When i try to add the send mail function in the AjaxCreateview the ajaxview is not being loaded anymore and i cant add the send_mail function. How Can i add the send mail function to validate the form and send it in the needed Ajaxview? Thanks in advance -
While I running my django project I am getting "ImportError: Module "logging.config" does not define a "dictConfig" attribute/class" error
I am running my Django project using manage.py runserver but it fails to start n giving following error C:\Users\Indrajit\Desktop\Mhakave\APp\src>manage.py runserver Unhandled exception in thread started by <function wrapper at 0x039466F0> Traceback (most recent call last): File "C:\Python27\lib\site-packages\django-1.10-py2.7.egg\django\utils\autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "C:\Python27\lib\site-packages\django-1.10-py2.7.egg\django\core\management\commands\runserver.py", line 113, in inner_run autoreload.raise_last_exception() File "C:\Python27\lib\site-packages\django-1.10-py2.7.egg\django\utils\autoreload.py", line 249, in raise_last_exception six.reraise(*_exception) File "C:\Python27\lib\site-packages\django-1.10-py2.7.egg\django\utils\autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "C:\Python27\lib\site-packages\django-1.10-py2.7.egg\django\__init__.py", line 22, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "C:\Python27\lib\site-packages\django-1.10-py2.7.egg\django\utils\log.py", line 69, in configure_logging logging_config_func = import_string(logging_config) File "C:\Python27\lib\site-packages\django-1.10-py2.7.egg\django\utils\module_loading.py", line 27, in import_string six.reraise(ImportError, ImportError(msg), sys.exc_info()[2]) File "C:\Python27\lib\site-packages\django-1.10-py2.7.egg\django\utils\module_loading.py", line 23, in import_string return getattr(module, class_name) ImportError: Module "logging.config" does not define a "dictConfig" attribute/class what should I do -
How to call django decorator only once per session?
i want to call custom decorator only once per session def cust_decorator(function): def wrapper(request,*args, **kwargs): ........ ....... wrapper.__doc__ = function.__doc__ wrapper.__name__ = function.__name__ return wrapper i want to call cust_decorator decorator only once per session for a particular user -
Reverse Count of ManytoManyField with a condition
I have a usecase where I have to count occurences of a ManyToManyField but its getting more complex than I'd think. models.py: class Tag(models.Model): name = models.CharField(max_length=100, unique=True) class People(models.Model): tag = models.ManyToManyField(Tag, blank=True) Here I have to come up with a list of Tags and the number of times they appear overall but only for those People who have >0 and <6 tags. Something like: tag1 - 265338 tag2 - 4649303 tag3 - 36636 ... This is how I came up with the count initially: q = People.objects.annotate(tag_count=Count('tag')).filter(tag_count__lte=6, tag_count__gt=0) for tag in Tag.objects.all(): cnt = q.filter(tag__name=tag.name).count() # doing something with the cnt But I later realised that this may be inefficient since I am probably going through People's table many times (Records in People are way larger than those in Tag). Intuitively I think I should be able to do one iteration of Tag's table without any iteration of People's table. So then I came up with this: for tag in Tag.objects.all(): cnt = tag.people_set.annotate(tag_count=Count('tag')).filter(tag_count__lte=6).count() # doing something with the cnt But, first, this is not producing the right results. Second, I am thinking this has become more complex that it seemed to be, so perhaps I am complicating … -
__str__ method not being invoked in this django application when calling from foreignkey field
I have this model: class Country(models.Model): name=models.CharField(max_length=100,unique=True) createdon=models.DateTimeField(auto_now_add=True) updatedon=models.DateTimeField(auto_now=True) def __str__(self): return self.name class Guest(models.model): nationality=models.ForeignKey(Country,related_name='guest-nation') in my views.py, I do this: guest=Guest.objects.all().values('nationality') In my template: {% for info in guest %} {{ info.nationality }} {% endfor %} Now, I am hoping the nationality field to return name of the country but it returns id of the country (as stored in nationality_id) field. From the documentation, I understood it is supposed to return the value specified in the str method. I can access the name if i the values is nationality__name. It looks uglier than I thought and I am somehow convinced it is supposed to call the str method. Am I wrong? -
Django Like count is not incrementing
I added a like button to my site and it gets highlighted when clicked on it but does not increment the number of likes or shows the count in the admin. I am not understanding what is the mistake I have done. Please help me to solve this. My code is as follows. models.py class Post(models.Model): post = models.TextField() user = models.ForeignKey(User) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) likes = models.IntegerField(default=0) def __str__(self): return self.post views.py @login_required def about(request,pk): context = {} template = 'about.html' return render(request, template, context) post = get_object_or_404(Post, pk=pk) Post.objects.get(pk=pk) post_id = post.pk liked = False if request.session.get('has_liked_' + str(post_id), liked): liked = True print("liked {}_{}".format(liked, post_id)) context = {'post': post, 'liked': liked} return render(request, 'imagec/about.html', {'post': post}) @login_required() def like_post(request): liked = False if request.method == 'GET': post_id = request.GET['post_id'] post = Post.objects.get(id=int(post_id)) if request.session.get('has_liked_'+post_id, liked): print("unlike") if post.likes > 0: likes = post.likes - 1 try: del request.session['has_liked_'+post_id] except KeyError: print("keyerror") else: print("like") request.session['has_liked_'+post_id] = True likes = post.likes + 1 post.likes = likes post.save() return HttpResponse(likes, liked) urls.py url(r'like_post/$', imagec_views.like_post, name='like_post'), about.html <p> <strong id="like_count">{{ post.likes }}</strong> people like this category {% if user.is_authenticated %} <input type="button" onclick="jQuery(this).toggleClass('active')" data-post_id="{{post.id}}" id="likes" value ='Like'> {% … -
How to run Django project locally for Heroku
I have a Django project and the structure is as following, Inside the Procfile, I have this code, web: gunicorn team-app.wsgi --log-file - This is the requirements.txt, appdirs==1.4.3 coreapi==2.3.0 coreschema==0.0.4 dj-database-url==0.4.2 Django==1.11 django-allauth==0.31.0 django-rest-auth==0.9.1 django-rest-swagger==2.1.2 djangorestframework==3.6.2 gunicorn==19.7.1 itypes==1.1.0 Jinja2==2.9.6 MarkupSafe==1.0 oauthlib==2.0.2 openapi-codec==1.3.1 packaging==16.8 pyparsing==2.2.0 python-openid==2.2.5 pytz==2017.2 requests==2.13.0 requests-oauthlib==0.8.0 simplejson==3.10.0 six==1.10.0 uritemplate==3.0.0 whitenoise==3.3.0 env is the virtualenv installed locally. When I enter in the root folder, team-app and run the command heroku local web, I get the following error, How to solve this issue? -
How to calculate the sum of a property
Hello everyone here is my question: models.py class Plant(models.Model) nominal_power = models.PositiveIntegerField() module_nominal_power= models.PositiveIntegerField() @property def no_modules(self): return round(self.nominal_power*1000/self.module_nominal_power) views.py def home(request): plants = Plant.objects.filter(user=request.user) total_power = plants.aggregate(sum=Sum('nominal_power')) total_no_modules = plants.aggregate(sum=Sum('no_modules'))['sum'] template = 'data/home.html' context = {'plants':plants, 'total_power':total_power, 'total_no_modules':total_no_modules} return render(request, template, context) And I get the error Cannot resolve keyword 'no_modules' into field.Cannot resolve keyword 'no_modules' into field. I undestand the meaning of the failure but how can I get the total number? -
How to pass parameters to ListView?
How to pass variables from done() to ListView? done() method of some object: def done(self) ... min_amount = 100 max_amount = 500 return redirect(reverse('board:search-result')) urls.py: ... url(r'^results$', SearchAdvertResultView.as_view(), name='search-result', ), ... views.py: ... class SearchAdvertResultView(ListView): template_name = "board/search_results.html" def get_queryset(self): return Adverts.objects.filter(amount__range=(min_amount, max_amount)) ... -
ImportError: No module named caching.base
I am running a project in django and I get this error: ImportError: No module named caching.base when django try to run this code: from caching.base import CachingManager, CachingMixin what should I do? what package should I install? -
filter by default with now() and earlier djangorestframework
I'm passing date parameters from angualrjs controller to my restapi, now the date parameter is not specified so I need to filter by default with now() and earlier on parameter which I'm sending to restapi so if I'm understanding correctly filter should be in the get function on the view, probably, like I said probably because I'm in a dilemma on this one, and asking from someone to explain to me how can I do this. You can check my controller and view down bellow. app = angular.module 'cms.sales' app.controller 'FilterContactsListCtrl', ['$scope', '$http', ($scope, $http) -> savedSuccessMessage = "Contact leads list was updated" savedFailMessage = "Failed to update contact leads list" $scope.selectDate = null $scope.init = (nextSelectedDate)-> if nextSelectedDate $scope.selectDate = nextSelectedDate else $scope.selectDate = "" $scope.doAction = () -> data = { select_date: $scope.selectDate } $http.post("/api/sales/lead_contact/", data).then( nextContactListUpdateSuccess, nextContactListUpdateFailed ) nextContactListUpdateSuccess = ()-> ClientNotifications.showNotification("Success", "Contact Leads list page was updated", "success") nextContactListUpdateFailed = () -> ClientNotifications.showNotification("Alert", "Failed to update contact leads list page", "alert") ] ModelViewSet: class LeadContactViewSet(viewsets.ModelViewSet): def get_queryset(self): queryset = LeadContact.objects.none() user = self.request.user if user.has_perm('vinclucms_sales.can_view_full_lead_contact_list'): queryset = LeadContact.objects.all() elif user.has_perm('cms_sales.can_view_lead_contact'): queryset = LeadContact.objects.filter(account_handler=user) return queryset # rest of the view below ..... -
Getting Error when create superuser "TypeError: 'is_staff' is an invalid keyword argument for this function"
I am trying to create superuser with this command on linux: python manage.py createsuperuser I also tried with sudo. It gives the error to me . Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 63, in execute return super(Command, self).execute(*args, **options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 345, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 183, in handle self.UserModel._default_manager.db_manager(database).create_superuser(**user_data) File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/models.py", line 168, in create_superuser return self._create_user(username, email, password, **extra_fields) File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/models.py", line 149, in _create_user user = self.model(username=username, email=email, **extra_fields) File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/base_user.py", line 68, in __init__ super(AbstractBaseUser, self).__init__(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 555, in __init__ raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0]) TypeError: 'is_staff' is an invalid keyword argument for this function Please Let me know if anybody knows the solution of this problem. Thanks -
Bootstrap-django click event for a particular node
How to write a onclick event for a particular node in a bootstrap tree?? Following is my treview def get_context_data(self, **kwargs): context = dict() organization = Organization.objects.all() orglocations = Orglocations.objects.all() locationprocessarea = Locationprocessarea.objects.all() processareaasset = Processareaasset.objects.all() processtaglink = Processareaassettaglink.objects.all() context["TreeStructure"] = [ { 'text': organizations.name, 'nodes': [ { 'text': orglocationss.name, 'tags':[orglocationss.name], 'nodes': [ { 'text': processarea.name, 'tags':[processarea.name], 'nodes': [ { 'backcolor': ["red"], 'text': processasset.name, 'tags':[processasset.name], 'nodes': [{ 'text': processareafilter.name, 'tags':[processareafilter.name] }for processareafilter in processareaasset.filter(parentassetid=processasset.id)] } for processasset in processareaasset.filter(processareaid=processarea.id).filter(parentassetid__isnull=True)] } for processarea in locationprocessarea.filter(locationid=orglocationss.id)] } for orglocationss in orglocations.filter(organizationid_id=organizations.id)] } for organizations in organization.filter(id=1)] return { "tree_view": context } How to write click event for processareafilter. Expecting for help..Thanks!! -
Set model's field via onlick (django)
first of all, sorry for my english :D this is my code: models.py class Photos(models.Model): username = models.CharField(max_length=50) caption = models.CharField(max_length=150, blank=True, null=True) img = models.ImageField(upload_to = 'userProfile/static/img', null=True, blank=True) update_date = models.DateTimeField(default=timezone.now) category = models.CharField(max_length=50, blank=True, null=True) likes_count = models.IntegerField(blank=True, null=True) class Meta: managed = False db_table = 'photos' and this is a part of html code that my js code produces <div class="container_card"> <img class="container_card_image" onclick="..." src="/static/img/1/uploads/img1.jpg"> </div> I want that when you click on the image, 'likes_count' is incremented without refresh the page (like instagram or like all social network). Then, if i use <a href="{% url 'like' value=user.id %}> <img ...> </a> and a view defined in this way, it increases the likes_count but is not good because it refesh the page for each click urls.py urlpatterns = [ ... url(r'^(?P<value>\w+)$', views.like, name='like'), ] views.py def like(request, value): photo = Photos.objects.get(pk=value) photo.likes_count += 1 photo.save() return redirect('home') Is there a way to get what I want? -
django content type getting two values
hello im trying to make a comment section for my blog. im struggling with the content_type a bit. here is my views.py (there is a second form but I cut it ou so its not to long) def mypost(request, slug=None): instance = get_object_or_404(Post, slug=slug) share_string = quote_plus(instance.content) initial_data = { "content_type": instance.get_content_type, "object_id": instance.id } comment_form = CommentForm(request.POST or None, initial=initial_data) if comment_form.is_valid(): c_type = comment_form.cleaned_data.get("content_type") #print ('type: ',c_type) content_type = ContentType.objects.get(model=c_type) obj_id = comment_form.cleaned_data.get("object_id") content_data = comment_form.cleaned_data.get ("content") new_comment, created = Comment.objects.get_or_create( user = request.user, content_type = content_type, object_id = obj_id, content = content_data, ) comment = instance.comment context = { "title": instance.title, "instance": instance, "share_string": share_string, "articles": articles, 'form': form, 'comment':comment, "comment_form":comment_form } return render(request, "my_profile/mypost.html", context) and in my Post model I have this @property def get_content_type(self): instance = self content_type = ContentType.objects.get_for_model(instance.__class__) print('the content type is: ',content_type) return content_type it all seems to work also the print values give me the right answers but when I try to upload a comment I get get() returned more than one ContentType -- it returned 2! so this line in views content_type = ContentType.objects.get(model=c_type) is causing the problem somehow but I don't know where the problem is. when I … -
solving from django by example, i wanted post by slug not by date
i am beginner in django, i am solving problem from django by example, i wanted post by slug not by date so made couple changes, example localhost:8000/blog/slug models.py class Post(models.Model): STATUS_CHOICES=( ('draft','Draft'), ('published','Published') ) published = PublishedManager() #Post title title=models.CharField(max_length=250); #slug is intended for used in url slug can be used for the date and slug #for post slug=models.SlugField(max_length=250,unique_for_date='publish') #author used to define many to one relationship post is written by user and user can wrote many post author=models.ForeignKey(User,related_name='blog_post') #body of post body=models.TextField() #publish is datetime publish=models.DateTimeField(default=timezone.now) #created is indicate for when the post is created date will save automatically as we creating object created= models.DateTimeField(auto_now_add=True) #updated ia indicate when lat time post is updated updated=models.DateTimeField(auto_now=True) #show status of post we use choices parameter Status=models.CharField(max_length=10,choices=STATUS_CHOICES,default='draft') objects = models.Manager() # The default manager. def get_absolute_url(self): #return reverse('blog:post_detail',args=[self.publish.year,self.publish.strftime('%m'),self.publish.strftime('%d'),self.slug]) return reverse('blog:post_detail1',args=[self.slug,]) class Meta: ordering=('-publish',) def __str__(self): return self.title class comment(models.Model): post = models.ForeignKey(Post,related_name='comments') name=models.CharField(max_length=80) email=models.EmailField() body=models.TextField() created=models.DateTimeField(auto_now_add=True) updated=models.DateTimeField(auto_now=True) active=models.BooleanField(default=True) class Meta: ordering =('created',) def __str__(self): return 'comment by {} on {}'.format(self.name,self.post) urls.py url(r'^(?P<post>[-\w]+)/$',views.post_detail1,name='post_detail1') views.py def post_detail1(request,post): #post = get_object_or_404(Post,slug=post,Status='published',publish_year=year,publish_month=month,publish_day=day) post = get_object_or_404(Post, slug=post,Status='published') comments=post.comments.filter(active=True) if (request.method=='POST'): #A comment was posted comment_form=CommentForm(data=request.POST) #if comment_form is valid create the commnet but dont push in database … -
Django redirects with languages and urlresolvers.reverse
I'm trying to test a redirect to a login page but my desired expected test condition can't match the response.location because of the language settings. For example, I want to do the following. self.assertRedirects(response, "{0}?next={1}".format(reverse('auth_login'), reverse('profile')), status_code=302, target_status_code=302) but the error is AssertionError: Response redirected to '/accounts/login/?next=/en/profile', expected '/en/accounts/login/?next=/en/profile' I don't know what the best practice is for this? Should I: Hard code the expected url to '/accounts/login/?next=/en/profile' which is what seems to be implied by the django docs. Make a custom reverse_no_il8n as suggested here that uses regex to chop off the language code from urlresolvers.reverse Something else? -
Online judge system Django
I did web-site by using django. I want to add online judge system to my web-site. User send solution (cpp, java and other files) via my site like a codeforces.com and other. How to do it? -
Getting Primary Key from database (Python / Django)
I'm trying to use Hashids which works when I manually input the number to encode, but doesn't work if I try to get it to encode the Primary Key from each table row. models.py from hashids import Hashids from django.db import models class AddToDatabase(models.Model): hashids = Hashids() slug = models.CharField(default=hashids.encode(pk), max_length=12) The above says pk is undefined, regardless of what I try to import. -
Dajngo form widgets and the choice is not one of available choices
Hello friends, I want to ask you for help. I'm trying to change the default value of the "true / false" checkboxes to another. Unfortunately. I recive a form error: “the choice is not one of available choices”. Please tell me what have I done wrong ? models.py CHECKBOX_CHOICES = (('1', 'The first choice'), ('2', 'The Second Choice')) class Order(models.Model): paid = models.CharField(max_length=350, choices=CHECKBOX_CHOICES) forms.py from django import forms from .models import Order class OrderCreateForm(forms.ModelForm): class Meta: model = Order fields = ['paid'] widgets = { 'paid': forms.CheckboxSelectMultiple() } create.html <form action="." method="post" class="order-form"> {{ form.as_ul }} <p><input type="submit" value="Submit"></p> {% csrf_token %} </form> rendered html <ul id="id_paid"> <li><label for="id_paid_0"><input type="checkbox" name="paid" value="" checked="" id="id_paid_0"> ---------</label> </li> <li><label for="id_paid_1"><input type="checkbox" name="paid" value="1" id="id_paid_1"> The first choice</label> </li> <li><label for="id_paid_2"><input type="checkbox" name="paid" value="2" id="id_paid_2"> The Second Choice</label> </li> </ul> It's important to me, even though it's a little thing, Any hints or suggestions would be welcome.