How to approach

111 views
Skip to first unread message

Trippy Samurai

unread,
Nov 4, 2021, 1:59:39 PM11/4/21
to Django users
Hi there,
I am new to django and have a problem statement am not quite sure how to approach this,Please help me,


Phase 1 Objectives:
  1. Use the existing project setup you have already created  You may completely reset Django models/database/codebase if needed but make sure you keep celery/redist/celery flower docker setup 
  2. Extend default Django user model (very imp. you should research/read on this if not sure)
    a. user with same email address can only signup as either manager or as developer
    b. Add more models as needed (i.e. Ticket etc)
  3. Create different Profile models for PM and Developer (hint: one to one relation to User)  
  4. Create Two signup page where user can create account as project manager and as  developer 
  5. Create two different login pages for PMs and Developers 
  6. Each user type is greeted with basic welcome message i.e. dashboard

PM Features :
  1. Can create new ticket with title and info/description field 
  2. Can mark ticket as closed once it is marked completed by developer

Developer Features:
  1. Can accept one or more Ticket if it is open
  2. After accepting a ticket it can not be accepted by another developer. Only one user can accept one ticket at a time
  3. Developer can then mark accepted ticket as completed 

Phase 2 Objectives: 
  1.  PM Dashboard :
    1. See existing Open tickets
    2. See Accepted tickets 
    3. See Completed tickets
    4. See Closed tickets 
  2. Developer Dashboard 
    1. See Open tickets 
    2. See Accepted tickets 
    3. See Completed tickets 
    4. See Closed tickets

           Thank you,

Aashish Kumar

unread,
Nov 4, 2021, 2:29:17 PM11/4/21
to django...@googlegroups.com
It’s very easy to perform in Django do it yourself 

--
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/eb344d25-1f60-4cae-8f2f-0e6abb2417abn%40googlegroups.com.

Kasper Laudrup

unread,
Nov 4, 2021, 5:36:41 PM11/4/21
to django...@googlegroups.com
On 04/11/2021 14.54, Trippy Samurai wrote:
> Hi there,
> I am new to django and have a problem statement am not quite sure how to
> approach this,Please help me,
>

I think you should approach it just as it has been described, i.e. one
step at a time.

Kind regards,

Kasper Laudrup
OpenPGP_0xE5D9CAC64AAA55EB.asc
OpenPGP_signature

Sebastian Jung

unread,
Nov 4, 2021, 7:22:43 PM11/4/21
to django...@googlegroups.com
Hello,

Take a beginner guide like django girls tutorial. Then begin with your task step for step. It exists many turorials how to build login page with django etc.pp. and when you have a specific Problem then write and i think most of us can help you.

Regards

Robin Riis

unread,
Nov 5, 2021, 2:24:14 AM11/5/21
to django...@googlegroups.com
i agree with kasper, but one tip is to start with the user class.
check out django.contrib.auth.base_user

--
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.

Trippy Samurai

unread,
Nov 6, 2021, 2:15:12 AM11/6/21
to Django users
As i am beginner i am struggling I tried and created as per it,I created two signup forms and login pages with same logic i.e same code snippet two times while signup it's fine but while logging in irrespective of the usertype it is logging into same user every time ,The issue here is how do i differentiate the user while logging in,Please take a look at the code and give inputs.


models.py

class Developer(models.Model):
developer = models.OneToOneField(User,on_delete=models.CASCADE)
is_developer = models.BooleanField(default=True)


def __str__(self):
return self.user.username

class ProjectManager(models.Model):
manager = models.OneToOneField(User,on_delete=models.CASCADE)
is_developer = models.BooleanField(default=False)

def __str__(self):
return self.user.username





forms.py:

class DeveloperForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput())

class Meta():
model = User
fields = ('username','email','password')


class ProjectManagerForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput())
class Meta():
model = User
fields = ('username','email','password')


views.py:


def index(request):
return render(request,'app/index.html',{})


def register(request):
return render(request,'app/register.html')

def user_login(request):
return render(request,'app/login.html')

def developer_signup(request):
registered = False

if request.method == 'POST':
user_form = DeveloperForm(data=request.POST)

if user_form.is_valid():
user = user_form.save()
user.set_password(user.password)
user.save()
registered = True
else:
print(user_form.errors)
else:
user_form = DeveloperForm()
return render(request,'app/dev-signup.html',
{'user_form':user_form,
'registered':registered})

def manager_signup(request):
registered = False

if request.method == 'POST':
pm_form = ProjectManagerForm(data=request.POST)

if pm_form.is_valid():
user = pm_form.save()
user.set_password(user.password)
user.save()
registered = True
else:
print(pm_form.errors)
else:
pm_form = ProjectManagerForm()
return render(request,'app/pm-signup.html',
{'pm_form':pm_form,
'registered':registered})


def pm_signin(request):

if request.method=='POST':
username=request.POST.get('username')
password=request.POST.get('password')

manager=authenticate(username=username,password=password)

if manager:
if manager.is_active:
login(request,manager)
return render(request,'app/dev-dash.html')
else:
return HttpResponse('account not active')
else:
print ('someone failed login')
print ('email: {} and password: {}'.format(username,password))

return HttpResponse('<h1>invalid login</h1>')
else:
return render(request,'app/pm-signin.html',{})


def dev_signin(request):

if request.method=='POST':
username=request.POST.get('username')
password=request.POST.get('password')

developer=authenticate(username=username,password=password)

if developer:
if developer.is_active:
login(request,developer)
return render(request,'app/pm-dash.html')
else:
return HttpResponse('account not active')
else:
print ('someone failed login')
print ('email: {} and password: {}'.format(username,password))

return HttpResponse('<h1>invalid login</h1>')
else:
return render(request,'app/pm-signin.html',{})




Gabo LaTo

unread,
Nov 15, 2021, 1:49:42 PM11/15/21
to django...@googlegroups.com
Hi Trippy.

Be more specific about what part is causing you troubles

--
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.

Trippy Samurai

unread,
Nov 15, 2021, 3:47:50 PM11/15/21
to Django users
Hi elgato,
Thanks for your reply brother

I need to change the function based views into class based and generic views, previously i have implemented different html pages for all the views like completed,opened,accepted and closed tickets, with class based views i need to have everything in one single html file ri8 if i am not wrong it follows some convention like modelname_list.html on top of that i have multi user signin developer and manager.i am stuck with this how to implement and u can see the html file below which displays the open tickets for developer and there are 8 different html pages for developer and manager for 4 status of ticket as i mentioned at the starting of this message they all should be in one html page if i use class based generic view(list view) i am stuck plz help....


Screenshot 2021-11-15 at 9.09.41 PM.png


Screenshot 2021-11-15 at 8.57.33 PM.png

Trippy Samurai

unread,
Nov 15, 2021, 7:13:28 PM11/15/21
to Django users
The conclusion is that i have 8 html pages  4 for developer and 4 for manager which have slight changes in the table headers i.e Opened,accepted.completed,closed, aftter using listview all of them come into one html file because of one model i need them to display accordingly with respect to each user logged in . How do i acheive this

Kasper Laudrup

unread,
Nov 15, 2021, 7:19:29 PM11/15/21
to django...@googlegroups.com
On 15/11/2021 20.13, Trippy Samurai wrote:
> The conclusion is that i have 8 html pages  4 for developer and 4 for
> manager which have slight changes in the table headers i.e
> Opened,accepted.completed,closed, aftter using listview all of them come
> into one html file because of one model i need them to display
> accordingly with respect to each user logged in . How do i acheive this
>

http://www.learningaboutelectronics.com/Articles/How-to-add-an-if-statement-to-a-template-in-Django.php
OpenPGP_0xE5D9CAC64AAA55EB.asc
OpenPGP_signature

Zaid Ullah

unread,
Nov 15, 2021, 8:06:03 PM11/15/21
to Django users
Sir I am also beginner in Django and i also want to create login, sign in file but i don't know how to do it...if you did successfully please send me the code i will learn from it and make one another by self... 
Thanks

Reply all
Reply to author
Forward
0 new messages