Пример #1
0
    def _create_draft_suggestion(self):
        suggestion = Suggestion()
        suggestion.owner = self.member.global_user
        suggestion.goal = self.goal
        suggestion.is_draft = True
        suggestion.save()

        revision = Revision()
        revision.title = "not set"
        revision.description = "not set"
        revision.suggestion = suggestion
        revision.save()

        return suggestion
Пример #2
0
def index(request):
    employee_list = Userinfo.objects.all()
    if request.method=="POST":
        print(request.POST['title'])
        print(request.POST['people_array'])
      #  print(request.POST['file'])
        file = request.FILES['file']

        print(file)
        filename = file._name
        print(filename)
        file.chunks()

        people_list = str(request.POST['people_array'])
        people_list = people_list.split(',')
        upload_file = UploadFileModel()
        upload_file.file = file
        upload_file.title = filename
        upload_file.save()
        obj = Suggestion.objects.last()
        file_locate = int(obj.file_locate)+1
        for people in people_list:
            suggest = Suggestion()
            suggest.title = request.POST['title']
            suggest.sender = request.session['user_num']
            suggest.reciever = int(people.strip())
            suggest.sender_name = request.session['user_name']
            suggest.status = 0
            suggest.file = file
            suggest.file_locate = file_locate
            user = Userinfo.objects.get(user_num=suggest.reciever)
            suggest.reciever_name = user.user_name
            suggest.save()


        return render(request,'suggestion/index.html',{'employee_list':employee_list,'rank':request.session['user_rank']})
    else:
    #    employee_list = Userinfo.objects.all()

        return render(request,'suggestion/index.html',{'employee_list':employee_list,'rank':request.session['user_rank']})
Пример #3
0
    def __create_suggestions(self):
        self.yoga_bend = Suggestion()
        self.yoga_bend.goal = self.become_a_yogi
        self.yoga_bend.owner = self.user_mnieber
        self.yoga_bend.is_draft = False
        self.yoga_bend.image = "suggestions/KroukTom-710x300-crop.jpg"
        self.yoga_bend.slug = "bend-backwards"
        self.yoga_bend.save()

        yoga_bend = Revision()
        yoga_bend.title = "Bend backwards"
        yoga_bend.description = yoga_bend_content
        yoga_bend.suggestion = self.yoga_bend
        yoga_bend.save()

        self.yoga_meditate = Suggestion()
        self.yoga_meditate.goal = self.become_a_yogi
        self.yoga_meditate.owner = self.user_mnieber
        self.yoga_meditate.is_draft = False
        self.yoga_meditate.image = "suggestions/Yoga_Nidra.jpg"
        self.yoga_meditate.slug = "meditate-often"
        self.yoga_meditate.save()

        yoga_meditate = Revision()
        yoga_meditate.title = "Meditate often"
        yoga_meditate.description = yoga_meditate_content
        yoga_meditate.suggestion = self.yoga_meditate
        yoga_meditate.save()

        self.yoga_twist = Suggestion()
        self.yoga_twist.goal = self.become_a_yogi
        self.yoga_twist.owner = self.user_anders_om
        self.yoga_twist.is_draft = False
        self.yoga_twist.image = "suggestions/MC_AM06_00_sized2.jpg"
        self.yoga_twist.slug = "keep-twisting"
        self.yoga_twist.save()

        self.rev_yoga_twist = Revision()
        self.rev_yoga_twist.title = "Keep twisting"
        self.rev_yoga_twist.description = yoga_twist_content
        self.rev_yoga_twist.suggestion = self.yoga_twist
        self.rev_yoga_twist.save()

        time.sleep(1)

        self.rev_yoga_twist_2 = Revision()
        self.rev_yoga_twist_2.title = "Keep twisting"
        self.rev_yoga_twist_2.description = yoga_twist_2_content
        self.rev_yoga_twist_2.suggestion = self.yoga_twist
        self.rev_yoga_twist_2.save()

        self.yoga_acrobatics = Suggestion()
        self.yoga_acrobatics.goal = self.become_a_yogi
        self.yoga_acrobatics.owner = self.user_marie_houana
        self.yoga_acrobatics.is_draft = False
        self.yoga_acrobatics.image = "suggestions/yoga-acrobats.jpg"
        self.yoga_acrobatics.slug = "yoga-acrobatics"
        self.yoga_acrobatics.save()

        yoga_acrobatics = Revision()
        yoga_acrobatics.title = "Acrobatics"
        yoga_acrobatics.description = yoga_acrobatics_content
        yoga_acrobatics.suggestion = self.yoga_acrobatics
        yoga_acrobatics.save()