Re: django templates stop to working html autocomplete

2020-05-07 Thread Carson
What do you want to autocomplete but not?

If you use Python as the main language, It so recommends that you convert 
IDE to PyCharm.

Eren ARTUÇ於 2020年5月8日星期五 UTC+8上午7時09分18秒寫道:
>
> hello everyone,
>
> Im using Vs.Code. When i enabled to django templates, my HTML autocomlete 
> doesnt work. i want to work Python and HTML at the same time. How can i 
> solve this problem ? Do you have any idea ? 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dc093804-03b9-4a33-bf4f-4542b46294e0%40googlegroups.com.


How to create a dynamic form queryset on using inlineformset_factory?

2010-08-13 Thread carson
hi all,
  i use inlineformset_facotry to edit & save the additional values for
my model.


#model.py

class ListingShippingService(models.Model):
site = models.ForeignKey(Site)
is_international = models.BooleanField(default=False)
is_flat = models.BooleanField(default=False)
is_calculated = models.BooleanField(default=False)
service = models.CharField(max_length=255)
description = models.TextField()

class ListingShippingDomestic(models.Model):
listing = models.ForeignKey(Listing)
service = models.ForeignKey(ListingShippingService)
cost = models.CharField(max_length=255, help_text='("Input 0
for free shipping")')
additional_cost = models.CharField(max_length=255, blank=True,
null=True)
is_free = models.BooleanField(default=False)


class ListingShippingInternational(models.Model):
listing = models.ForeignKey(Listing)
service = models.ForeignKey(ListingShippingService)
cost = models.CharField(max_length=255)
additional_cost = models.CharField(max_length=255, blank=True,
null=True)
ship_to_locations =
models.ManyToManyField(ListingInternationalShippingArea)


#forms.py
class ListingShippingInternationalForm(forms.ModelForm):
def __init__(self, * args, ** kwargs):
site_id = kwargs.get('site_id',None)
del kwargs['site_id']
super(ListingShippingInternationalForm, self).__init__(*args,
** kwargs)
service =
models.ListingShippingService.objects.filter(site=site_id,
is_international=True)
self.fields['service'].queryset = service
self.fields['ship_to_locations'].queryset =
models.ListingInternationalShippingArea.objects.filter(site=site_id)
class Meta:
exclude = ('listing',)
model = models.ListingShippingInternational

#views.py
from django.forms.models import inlineformset_factory
import models,forms
internationalInlineFormSet  = inlineformset_factory(models.Listing,
models.ListingShippingInternational, max_num=3,
form=forms.ListingShippingInternationalForm(site_id='xx'))

### here is my problem the works is:
internationalInlineFormSet  = inlineformset_factory(models.Listing,
models.ListingShippingInternational, max_num=3,
form=forms.ListingShippingInternationalForm)
### once i put (site_id='xx'), it will not work,  how can i
passing the parameter to it for create dynamic form?

can anybody helps? Thx!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.