Exemple #1
0
def editproject(request,p_id):
    project=get_object_or_404(Project,pk=p_id)
    if request.method=='POST':
        proj=Project()
        proj.title=request.POST.get('title')
        proj.description = request.POST.get('description')
        update = Project.objects.filter(id=p_id).update(title=proj.title,description=proj.description)
        print(update)
        if update:
            messages.success(request, 'Your project has been updated successfully!')
            return redirect('dashboard')
        else:
            messages.success(request, 'Something Wrong!')
    return render(request, 'accounts/editproject.html',{'project':project})
Exemple #2
0
    def save(self, data, element_object=None):
        if element_object == None:
            project = Project()
            uid = self.generateUID()
            project.uid = uid
        else:
            project = element_object

        project.name = self.parseData(data, "name")
        project.description = self.parseData(data, "description")
        project.name_space = self.parseData(data, "name_space")
        project.provider = self.parseData(data, "provider")

        project.save()

        return { "status" : "success", "message" : "Project Created succefully", "element" :  "project", "uid" : project.uid }
def import_html_project(item, last_project, cache):
    entry = item.as_dict(html_project_fields_actual)
    if not entry['actual']:
        return None
    if entry['actual'].lower() == 'actual':
        #print 'entry',entry
        # Start of a project line
        # remove the "IEEE Std" from in front of the name, and any text after the name
        entry['name'] = entry['name'].split(' ')[2]
        if ',' in entry['par_date']:
            dates = entry['par_date'].split(',')
            entry['par_date'] = dates[0]
            entry['par_expiry'] = dates[-1]
            entry['par_expiry'] = entry['par_expiry'].replace('[]', '')
        else:
            entry['par_expiry'] = None
        try:
            p = Project.objects.get(name=entry['name'])
        except Project.DoesNotExist:
            p = Project(name=entry['name'], order=1)
        p.description = entry['description']
        p.doc_type = entry['doc_type']
        set_date(p, 'par_date', entry['par_date'])
        if entry['par_expiry']:
            set_date(p, 'par_expiry', entry['par_expiry'])
        p.task_group = entry['task_group']
        p.doc_format = entry['doc_format']
        if entry['mec_date']:
            set_date(p, 'mec_date', entry['mec_date'])
            p.mec_completed = True

        set_date_if_none(p, 'initial_wg_ballot', entry['wg_ballot_date'])
        if entry['wg_ballot_date']:
            initial, recirc = parse_ballot_dates(entry['wg_ballot_date'],
                                                 entry['wg_ballot_result'])
            if p.initial_wg_ballot is None and initial is not None:
                set_date(p, 'initial_wg_ballot', initial)
            if p.recirc_wg_ballot is None and recirc is not None:
                set_date(p, 'recirc_wg_ballot', recirc)
        if entry['sb_ballot_date']:
            initial, recirc = parse_ballot_dates(entry['sb_ballot_date'],
                                                 entry['sb_ballot_result'])
            if p.initial_sb_ballot is None and initial is not None:
                set_date(p, 'initial_sb_ballot', initial)
            if p.recirc_sb_ballot is None and recirc is not None:
                set_date(p, 'recirc_sb_ballot', recirc)
        set_date(p, 'sb_form_date', entry['sb_form_date'])
        set_date(p, 'wg_approval_date', entry['wg_approval_date'])
        set_date(p, 'ec_approval_date', entry['ec_approval_date'])
        set_date(p, 'revcom_approval_date', entry['revcom_approval_date'])
        set_date(p, 'ansi_approval_date', 'ansi_approval_date')
        set_date(p, 'withdrawn_date', 'withdrawn_date')
        if p.withdrawn_date is not None and p.withdrawn_date.toordinal(
        ) <= datetime.datetime.utcnow().toordinal():
            p.withdrawn = True
        if not p.pk:
            p.pk = cache.get_next_project_pk()
        cache.put_project(p)
        return p
    if last_project is None:
        return None
    if entry['actual'].lower() == 'predicted':
        entry = item.as_dict(html_project_fields_predicted)
        p = last_project
        #p. = entry['initial_wg_ballot_ver']
        set_date(p, 'initial_wg_ballot', entry['initial_wg_ballot_date'])
        #p. = entry['recirc_wg_ballot_ver']
        set_date(p, 'recirc_wg_ballot', entry['recirc_wg_ballot_date'])
        set_date(p, 'sb_form_date', entry['sb_form_date'])
        if not p.mec_completed:
            set_date(p, 'mec_date', entry['mec_date'])
        #p. = entry['initial_sb_ballot_ver']
        set_date(p, 'initial_sb_ballot', entry['initial_sb_ballot_date'])
        #p. = entry['recirc_sb_ballot_ver']
        set_date(p, 'recirc_sb_ballot', entry['recirc_sb_ballot_date'])
        set_date(p, 'wg_approval_date', entry['wg_approval_date'])
        set_date(p, 'ec_approval_date', entry['ec_approval_date'])
        set_date(p, 'revcom_approval_date', entry['revcom_approval_date'])
        #p.save()
    return None