-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#364 Added Models for Users Profile. #469
Conversation
city=models.CharField(max_length=100, blank=False, null=False) | ||
contact_no = models.CharField(max_length=10, blank=False, null=False) | ||
|
||
created = models.DateTimeField("Created", null=True, auto_now_add=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look in base/models
, there is already mix-in for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not get you properly ?? Please explain to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add created/modified
, there is already mixins for this. Have a look at junction/base/models.py
. AuditModel
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I got that. Thanks for guiding. :)
|
I am on writing tests. I will send a PR soon. |
|
@kracekumar I tried the command you mentioned above, but it is giving me some unexpected error. I also googled it but could not find anything relevant. Please look into it as I am putting the screenshot. |
Have you modified |
@ChillarAnand No, I haven't modified any of these files. Well I am running the junction module without docker. Is it because of that ? |
@RishabhJain2018 Can you paste the requirements file and can you merge master to your branch ? |
@kracekumar yeah sure. |
@kracekumar this is the requirements file & I have merged the master branch. |
@kracekumar Please help. |
Ok, I think you're using older version of pip. Upgrade the pip |
@kracekumar thanks for solving the issue. I upgraded my pip & it worked. I am again facing an error due to which my build is failing. please see to it. |
@RishabhJain2018 Please attach screen shot only for UI changes, else pass on the link or paste the output. Exception says |
@kracekumar Thanks for the guidance. :) |
|
||
|
||
class UserAdmin(admin.ModelAdmin): | ||
list_display = ('__unicode__', 'city', 'contact_no') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this __unicode__
required ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to display user name in Profile admin. corresponding to whom the city and contact_no belongs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove __unicode__
.
Before pushing the code, please rebase with the master branch. |
@kracekumar @theskumar I have made the changes as per the requirement. Please review it. |
|
||
elif request.method == "GET": | ||
user = get_object_or_404(User, pk=username.id) | ||
detail = get_object_or_404(Profile, user=user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we create a profile before this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChillarAnand I didn't get you. Please explain in detail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a user visits edit page, it is simply throwing a 404 page. Shouldnt we create a profile before if it doesnt exists for that user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChillarAnand okk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChillarAnand I have fixed the changes . Please see to it.
@ChillarAnand @kracekumar Please review the PR & tell me any other changes that needs to be done. 😃 |
|
||
|
||
class ProfileAdmin(admin.ModelAdmin): | ||
list_display = ('__unicode__', 'city', 'contact_no') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use user
instead of unicode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah sure. but can you explain me why user
is better?
@RishabhJain2018 Looks good. There are several migrations. Remove all files from migrations folder except |
@ChillarAnand I have done the changes and also squashed the migrations. |
Excellent. Thank you @RishabhJain2018 |
|
||
@login_required | ||
def profile(request): | ||
username = request.user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename the variable to user
?
username = request.user | ||
detail = None | ||
|
||
if request.method == "POST" and username == request.user: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I know why is the check username == request.user
required?
No description provided.