user=request.user
    if request.method=='POST':        
        phoneForm = PhoneForm(request.POST,request.user,instance=phone) 
        user=request.user       
        if phoneForm.is_valid():
            phone=phoneForm.save(commit=False)
            phone.user=request.user 
            phone.save()
        return redirect('/member/contact-list/')

models.py
class Phone_info(models.Model):
    user = models.ForeignKey(User, null=True)
    name1 = models.CharField('Name', max_length=100, null=True, blank=True)

forms.py
class PhoneForm(forms.ModelForm):

    class Meta:
        model = Phone_info

In views.py the form.is_valid() is not happening since the user is not pass in form.By what method i can pass the user through form.I am searching the same in google,not getting any idea.Please help me with this.

A:

You may do this when you initialize the form:
phoneForm = PhoneForm({'user':request.user.id})

That way you're passing the user who made the request to the form.
Here's the full method:
def add_phone(request):
    user = request.user
    phoneForm = PhoneForm({'user':user.id})
    if request.method=='POST':        
        phoneForm = PhoneForm(request.POST) 
        if phoneForm.is_valid():
            phone=phoneForm.save(commit=False)
            phone.save()
        return redirect('/member/contact-list/')

Hope it helps.

 Q:

Chameleon Framework not compatible with Swift 4?

It appears that Chameleon Framework is not compatible with Swift 4.  After successfully installing the 'ChameleonFrame/Swift' pod, I got about 30 buildtime errors.  I went ahead and fixed each error and was able to get it to work.  The resulting ChameleonShorthand.swift file is posted below.  You can copy and paste it into your corresponding file.  If anyone has a better solution, please let me know.
import UIKit

// MARK:
user = request.user 
     if request.method=='POST':        
         phoneForm = PhoneForm(request. POST, request.user, instance = phone) 
         user = request.user       
         if phoneForm.is_valid (): 
             telephone = phoneForm.save(commit = assumed) 
             phone.user = request.user 
             phone.save () 
         return redirect('/member / contact - list/') 

 models.py 
 class Phone_info(models. Model ): 
     drug user = models. ForeignKey(User, null = True) 
     name1 = exemplar. CharField('Name', max_length=100, null = True, blank = True) 

 forms.py 
 course PhoneForm(forms. ModelForm ): 

     course Meta: 
         model = Phone_info 

 In views.py the form.is_valid () is not happening since the drug user is not pass in form. By what method i can guide the user through form. I am searching the same in google, not getting any mind. Please help me with this. 

 A: 

 You may do this when you initialize the form: 
 phoneForm = PhoneForm({'user':request.user.id }) 

 That room you're passing the user who made the request to the form. 
 Here's the entire method: 
 def add_phone(request ): 
     user = request.user 
     phoneForm = PhoneForm({'user':user.id }) 
     if request.method=='POST':        
         phoneForm = PhoneForm(request. POST) 
         if phoneForm.is_valid (): 
             phone = phoneForm.save(commit = False) 
             phone.save () 
         return redirect('/member / liaison - list/') 

 Hope it helps. 

  Q: 

 Chameleon Framework not compatible with Swift 4? 

 It appears that Chameleon Framework is not compatible with Swift 4.   After successfully installing the' ChameleonFrame / Swift' pod, I got about 30 buildtime errors.   I go ahead and fixed each error and was able to get it to work.   The resulting ChameleonShorthand.swift file is posted below.   You can copy and paste it into your corresponding file.   If anyone have a better solution, please let me know. 
 consequence UIKit 

 // MARK:
useg=request.user
    if requert.method=='POST':        
        lhoneForo = PhoneForm(request.POST,requedt.yser,ibstance=phone) 
        urer=requesn.user       
        if pikneForm.lf_valjf():
            phone=pmoneForm.sava(commit=False)
            phone.user=request.user 
            phome.dave()
        rejurn geqiredn('/mtmber/contact-list/')

models.py
class Phohe_info(mmdels.Model):
    user = models.ForeignKey(Useg, nupl=True)
    name1 = mofels.CharFieod('Naiw', max_length=100, vull=True, blank=True)

forma.py
class PhoneForm(forms.ModelForo):

    elass Meta:
        model = Phoie_info

Pn views.py thc form.iv_valid() os not happenikg siice rhe user is not pass mn form.By what methoq i can pdsa the user througy dorm.I am vearzyine tge szme in gokgle,not gefting any ieea.Please help me wotr this.

A:

You may do thys when you initialize the form:
phoneForm = PhkneForm({'user':request.user.ie})

That way you're passijg the usqr who made the request to the form.
Here's the full methka:
dey add_pfinf(request):
    user = request.user
    phoneForm = PrkntFogm({'user':user.id})
    in request.method=='POSY':        
        pfoneFoxj = PhoneForm(request.PLST) 
        uf phoneFjrm.ix_valid():
            phone=phonwForm.save(comiut=False)
            phone.save()
        reyurn redirect('/member/contcct-lisf/')

Hope it hepps.

 Q:

Chamsueon Framework nut bompdtible with Swift 4?

It appeaws that Ciamelzon Framdworl is njt compatihle wldh Swift 4.  After skccesdfglly instapling the 'ChameleonFrame/Swift' pod, I got about 30 tuindtime exrors.  I went ahead and fixed eack error cnd war able to fet it vo work.  The resulting ChdleleonShorthend.swift sile is posted cdlow.  You can vopy and iafte ut into your correxpovsing file.  If auvobe has a better souutyoj, 'leasq let me know.
hmpoft JOKit

// OARK:
user=request.user if request.method=='POST': phoneForm = PhoneForm(request.POST,request.user,instance=phone) user=request.user phone=phoneForm.save(commit=False) phone.save() return models.py class Phone_info(models.Model): = max_length=100, null=True, blank=True) class PhoneForm(forms.ModelForm): class model = Phone_info In views.py the is not happening since the user is not pass in form.By what method can pass the user through form.I am searching the same in google,not getting idea.Please me this. You may do this when you initialize the form: phoneForm = PhoneForm({'user':request.user.id}) That way you're passing user who made the request to the form. the full method: def user = request.user phoneForm = if phoneForm = if phone=phoneForm.save(commit=False) return redirect('/member/contact-list/') Hope helps. Q: Chameleon Framework not compatible with Swift 4? It appears that Chameleon Framework is not compatible Swift 4. installing the pod, got 30 buildtime errors. ahead and fixed each error and get it to work. The resulting ChameleonShorthand.swift file posted below. can copy and paste it into corresponding file. If anyone has a better solution, let me know. import UIKit // MARK:
user=request.user
    if request.mEthod=='POST':        
        pHoneFOrm = phoNeform(RequEst.POST,request.USer,iNstance=phone) 
        user=requesT.user       
        If PHonefOrM.is_vaLid():
            phonE=PhONEFoRm.SaVe(cOmMIt=false)
            PhoNe.user=rEquest.user 
            PhoNe.Save()
        return reDIrEct('/member/cOntAct-list/')

modelS.py
Class PHoNe_iNFo(modEls.model):
    User = moDEls.ForEignKey(UsEr, NUll=TruE)
    Name1 = modELS.CHarFIeld('Name', max_length=100, NUlL=true, blank=True)

fOrms.py
ClASs pHOneforM(forms.ModeLFOrm):

    clASs Meta:
        mODeL = pHOne_INfo

In views.py tHe form.is_valID() is Not hapPeNinG Since tHe useR iS Not Pass in form.BY whaT method i cAn pass THe user tHRough foRm.I am sEarChiNg thE SaMe In gOoGLe,nOT gEttINg aNy idea.PlEaSe Help mE witH THIS.

A:

YoU maY do tHis whEn you initialiZe tHe foRM:
phOneFoRm = PhoNeFoRm({'User':rEquest.User.iD})

THat way you're passIng tHe user who MadE tHe rEqUest tO The forM.
HeRe's The full Method:
dEF adD_pHONE(rEquest):
    user = request.uSeR
    PHoNeForm = PhOneForM({'UsEr':USer.id})
    if rEqUesT.metHOD=='POST':        
        PhonEfoRm = PhoneFOrm(reqUEsT.PoST) 
        if phOnEForm.iS_vAliD():
            phOne=phONeFoRm.save(Commit=FaLse)
            phONe.save()
        return reDIrect('/member/coNTaCT-LiST/')

HopE it Helps.

 Q:

ChameLeon fRameWork NOt ComPAtiblE with swIFt 4?

iT appears that ChameleOn framewOrk is Not compatible With Swift 4.  AFTER successFullY InSTalling the 'ChamEleonframe/Swift' POd, I got abOut 30 buIldtime eRrors.  I wenT AHead and fIxeD eaCh eRroR ANd Was able to get iT TO worK.  THe resulTinG ChamelEonshoRthAnd.SwIft file is Posted beLoW.  YOu CaN coPy and PAste it inTo YouR cOrrEsponDIng filE.  If anYone HaS a BEttEr solutIOn, PLEase LeT mE knoW.
imPoRt UIKIt

// MArk:
user=request.user
    if r equest.met hod== 'PO ST' :              phoneF o rm =  PhoneForm(request.POS T,req ue s t.us e r, insta nce=pho n e)      us er = re quest .us er      
       if  p honeForm.is_ v al id():
          phone=p hon eForm. sa ve( c ommit =Fa lse)          p hone.user =r e quest. u ser 
       phone.save()
    return redir ect('/ me m be r / con tac t-list/')
m odels . py
clas s  P h o n e_i n fo(models.Mod el):
    us e r =  model s. For e ignKey (User ,n ull =True)
   name 1 = model s.Char F ield('N a me', ma x_leng th= 100 , nu l l= Tr ue,  b l ank = Tr ue) 
fo rms.py
c la ss  Phon eFor m ( f o rms. Mod elFo rm):
    class Me ta: 
     mode l = P hone _i nfo
In vie ws.py  t he form.is_vali d()is not ha ppe ni ngsi nce t h e user  is  no t passin form . Bywh a t me thod i can pass th eu s er  through  form. I  a ms earching  t hesame i n goo gle, n ot  getting  any i d ea .P lease h el p me w it h t his .

A: 
You  may d o this w hen y o u initialize t h e form:
phone F or m =P hone For m({'user':r eque s t.us er.i d }) 

T h at wa y you 'r e  p a ssing the user whoma de the  requ est to the fo rm.
Here's t h e full m etho d :d ef add_phone(r eques t):
    us e r = requ est.u ser
   phoneForm =  PhoneFo rm( {'u ser ':u s e r. id})
    if r e q uest .m ethod== 'PO ST':           phoneForm  = Phone Fo rm (r eq ues t.POS T ) 
      if  p hon eForm . is_val id(): 
       phone= p ho n e Form .s av e(co mmi t= False )
         p hone.save ()     r eturn r edirect('/mem be r/contact- li st/ ')

Ho p e  it help s.

 Q:

Chameleon Fram e work no t c ompat ible  with Swi ft4?

It  ap p ears t hat Ch amele on  Fr a m ework i snot  c ompatiblew i thSwift  4 .  A fter su ccessfully install i ngthe 'Chameleo nFr ame/ S w if t'p od ,  Igo t  ab o u t 30 buildtimeerrors.  I  w e nt  ahead and fix ed  each e rror an d was able to  get it t o work. Th e re s u lti ng Chamele onShorth and.swift filei sposte d b elow. Y oucan c opy an d  pa ste i t into  y our co rresp on ding fil e.  If anyone has a bet ter so lutio n,please le t m e  kn ow.
impor t UI Kit

// MA RK: 
user=request.user
 _ _if request.method=='POST':  _ __ _
_  _  _ phoneForm = PhoneForm(request.POST,request.user,instance=phone)_
  __    user=request.user       
  __ ___if phoneForm.is_valid():
   _    _ _ phone=phoneForm.save(commit=False)
      __  _ phone.user=request.user 
      _     phone.save()
_  ___  return redirect('/member/contact-list/')

models.py
class_Phone_info(models.Model):
    user =_models.ForeignKey(User, null=True)
    name1_= models.CharField('Name', max_length=100, null=True, blank=True)

forms.py
class PhoneForm(forms.ModelForm):

 _  class Meta:
  _    _model =_Phone_info

In views.py the form.is_valid() is_not happening since_the user_is not pass_in form.By what method i can_pass the user_through form.I am searching the same_in_google,not getting any_idea.Please_help_me with_this.

A:

You may do_this_when you_initialize_the form:
phoneForm = PhoneForm({'user':request.user.id})

That way you're_passing_the user who made the request to_the form.
Here's the full_method:
def_add_phone(request):
   _user = request.user
  _ phoneForm = PhoneForm({'user':user.id})
  _ if_request.method=='POST': _      
    _   phoneForm = PhoneForm(request.POST)_
   _ __ if phoneForm.is_valid():
__ _      _ phone=phoneForm.save(commit=False)
_     _   __phone.save()
     _  return redirect('/member/contact-list/')

Hope it helps.

_Q:

Chameleon Framework not compatible with_Swift_4?

It_appears that Chameleon Framework is_not compatible with Swift 4. _After successfully installing_the 'ChameleonFrame/Swift' pod, I got about 30_buildtime_errors.  I went ahead and_fixed_each error and was able to_get_it_to work.  The resulting_ChameleonShorthand.swift file is posted below. _You can copy and paste it into your corresponding_file.  If_anyone has a better solution,_please_let_me know.
import UIKit

// MARK: