Page Integration

已查看 87 次
跳至第一个未读帖子

Pooja Kumari

未读,
2022年11月10日 10:33:142022/11/10
收件人 django...@googlegroups.com
Hi.. Can anyone help me with django templates? Actually I have a registration page where user can signup and data will be saved in admin panel or database but I am not able to do that. Registration page is working when I hit URL but data is not saving in database. Let me know If anyone have idea about this type of project. I'll be very grateful for your help.

Lakshyaraj Dash

未读,
2022年11月10日 10:50:172022/11/10
收件人 django...@googlegroups.com
Please see that if you're calling the .save() method or not

On Thu, Nov 10, 2022, 21:02 Pooja Kumari <poojai...@gmail.com> wrote:
Hi.. Can anyone help me with django templates? Actually I have a registration page where user can signup and data will be saved in admin panel or database but I am not able to do that. Registration page is working when I hit URL but data is not saving in database. Let me know If anyone have idea about this type of project. I'll be very grateful for your help.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHYvwbWDVFjuddPah3WUX8M9H6ojvDSjQD_mn7W6AgcT_pQsGQ%40mail.gmail.com.

DJANGO DEVELOPER

未读,
2022年11月10日 11:34:072022/11/10
收件人 django...@googlegroups.com
you need to share the code.no one will be able to help you this way.

Desh Deepak

未读,
2022年11月10日 11:47:092022/11/10
收件人 django...@googlegroups.com

On Thu, Nov 10, 2022, 9:02 PM Pooja Kumari <poojai...@gmail.com> wrote:
Hi.. Can anyone help me with django templates? Actually I have a registration page where user can signup and data will be saved in admin panel or database but I am not able to do that. Registration page is working when I hit URL but data is not saving in database. Let me know If anyone have idea about this type of project. I'll be very grateful for your help.

amruth bitla

未读,
2022年11月10日 12:38:282022/11/10
收件人 django...@googlegroups.com
Ya easy and simple 😄

On Thu, 10 Nov, 2022, 9:03 pm Pooja Kumari, <poojai...@gmail.com> wrote:
Hi.. Can anyone help me with django templates? Actually I have a registration page where user can signup and data will be saved in admin panel or database but I am not able to do that. Registration page is working when I hit URL but data is not saving in database. Let me know If anyone have idea about this type of project. I'll be very grateful for your help.

Pooja Kumari

未读,
2022年11月10日 14:07:352022/11/10
收件人 django...@googlegroups.com
Where I have to use save() method? In models or somewhere else?

Chukwudi Onwusa

未读,
2022年11月10日 14:46:562022/11/10
收件人 django...@googlegroups.com
If you are using function based view in your views.py . After you must have equated the input values through the name attribute to the instance of the class in your model, then instance.save() before you redirect.
This should be done in the views.py not models.

Mh Raffi

未读,
2022年11月11日 00:04:102022/11/11
收件人 django...@googlegroups.com

Pooja Kumari

未读,
2022年11月11日 00:19:302022/11/11
收件人 django...@googlegroups.com
I tried many ways but nothing works.
Sorry this code is messed up but hope you get some idea what I'm trying to do.
In views.py
@api_view(['GET', 'POST', ])
def signUpPage(request, format=None):
  #permission_classes = (IsAuthenticated,)
  #authentication_classes = (TokenAuthentication,)
  serializer = AuthTokenSerializer(data=request.data)
  data= {'signUpPage': Employee.objects.all() }
  if request.method == "POST":
    empid=request.POST['empid']
    first_name=request.POST['first_name']
    last_name=request.POST['last_name']
    email=request.POST['email']
    password=request.POST['password']
    phone=request.POST['phone']
    register = NewUserSerializer(data=data, context={'request':request})
    if register.is_valid(raise_exception=True):
      register.save()
      print(register.data)
      #register.save()
  return Response("registration successfully")
  #return JsonResponse(data,template_name='signup.html',content_type="application/json")
'''
  '''
  #@action(detail=False, methods=['post'], name='register')
  def create(self, request):
    """
    Api to registration
    """
    try:
      data = request.data
      print(data)
      email = request.data.get("email")
      user_obj = Employee.objects.filter(email=email)
      print("35 line", user_obj)
      #print("...",user_obj)
      print("demo")
      if user_obj:
        return Response("User Already Exist With This Email Id")
      else:
        #new_user = NewUserSerializer(data=data, context={'request':request})
        #if new_user.is_valid(raise_exception=True):
        #  new_user.save()
        print("42 line")
        new_user = Employee.objects.create(empid=data.get('empid'),first_name=data.get('first_name'),last_name=data.get('last_name'),email=data.get('email'),password=data.get('password'),phone=data.get('phone'))
        print("user",new_user)
        return Response("registration successfully")
     
    except Exception as e:
      print("hello", str(e))
      return Response( "invalid data")
'''







'''
        name = request.data.get("name","")
        email= request.data.get("email","")'''



"""class UserDetailAPI(APIView):
  authentication_classes = (TokenAuthentication,)
  permission_classes = (AllowAny,)
  def get(self,request,*args,**kwargs):
    user = User.objects.get(id=request.user.id)
    serializer = UserSerializer(user)
    return Response(serializer.data)

#Class based view to register user
class RegisterUserAPIView(generics.CreateAPIView):
  permission_classes = (AllowAny,)
  serializer_class = RegisterSerializer
"""


M Adnan

未读,
2022年11月15日 22:46:522022/11/15
收件人 django...@googlegroups.com
Join Django developer what's app group link below to discuss Django questions


parmeshwar deharkar

未读,
2022年11月16日 08:29:072022/11/16
收件人 django...@googlegroups.com
Just visit on www.pythondjango.com
See that page registration access

On Thu, Nov 10, 2022, 9:02 PM Pooja Kumari <poojai...@gmail.com> wrote:
Hi.. Can anyone help me with django templates? Actually I have a registration page where user can signup and data will be saved in admin panel or database but I am not able to do that. Registration page is working when I hit URL but data is not saving in database. Let me know If anyone have idea about this type of project. I'll be very grateful for your help.

parmeshwar deharkar

未读,
2022年11月16日 08:34:112022/11/16
收件人 django...@googlegroups.com

Pooja Kumari

未读,
2022年11月16日 09:42:122022/11/16
收件人 django...@googlegroups.com

Toshar Saini

未读,
2022年11月21日 08:39:482022/11/21
收件人 django...@googlegroups.com
回复全部
回复作者
转发
0 个新帖子