V
V
Vasily Vorobyov2015-12-16 17:32:58
Django
Vasily Vorobyov, 2015-12-16 17:32:58

What is my level of django developer?

here is my repository:
https://github.com/zuberok/wts
The question is tormenting: Have I become a middle?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Roman Kitaev, 2015-12-16
@zuberok

@property
    def wall(self):
        result = self.posts.all()
        for friend in self.friends.all():
            if not result:
                result = friend.posts.all()
            else:
                result = result | friend.posts.all()
        return result.order_by('-id')

Same way.
And here it is:
ACCOUNT_SID = "**"
AUTH_TOKEN = "**"

client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
SENDER = '+14694252378'

Although, you probably changed the token. It didn't work for me. Or maybe it's just unpaid?
deposit_total = sum((x.total for x in _user.deposits.all()))
    outlays_total = sum((x.total for x in _user.outlays.all()))
    incomes_total = sum((x[0] for x in _user.tree_node1.cash_incomes)) if TN1.objects.filter(account__id=_user.id) else 0
    cashes_total = sum((x.total for x in _user.cashes.all()))
    income_transfers_total = sum((x.total for x in _user.income_transfers.all()))
    outcome_trasfers_total = sum((x.total for x in _user.outcome_transfers.all()))

Maybe it's better to use aggregation? If you have a million records, will you transfer everything to the RAM, and then count in python?
PARENT_PAYMENT = 50.0
GRANDPARENTS_PAYMENT = 100.0
LEVEL_REWARDS = (0.19, 0.17, 0.15, 0.13, 0.11, 0.09, 0.07, 0.05, 0.02, 0.01, 0.01)

In the models.py file
Usually this is taken out in the constants file. One per project or per app, depends on the developer, but it is clearly more convenient to look for and edit constants there.
CBV is preferable to ordinary views, if only because you don't need to fence this:
https://github.com/zuberok/wts/blob/master/project...
Half-empty apps (like apis or public with a lonely redirect) - why?
I can continue.
UPD:
Removed the token.

S
sim3x, 2015-12-16
@sim3x

No tests Settings
and external dependencies for production and dev in one file
Code in country files without description and with code that should be in models
You are a good trainee

K
kazmiruk, 2015-12-16
@kazmiruk

I would say no. From what I jumped at a cursory review of the code - absolute paths in settings, non-compliance with pep8 (terminal indent, length of lines. I myself do not think that 80 characters is a normal value, but a line of 146 characters is too much, at least 120). There is not a single test, imports are mixed, each method of the model with the property decorator (didn’t delve into the code very much, maybe it makes sense, but it’s unlikely in such an amount), don’t use CBV, although in some places it’s more appropriate, it’s not clear the meaning of creating the whole app for the sake of storing one function in 1 line of code, there is a clear misunderstanding of what and where is contained (Profile.objects.create(user=User.objects.get(id=request.user.id)), User.objects.get( id=request.user.id)), not understanding what requests are doing (sum([x.total for x in request.user.outlays.filter(type=2)])). I also didn’t see indexes anywhere, maybe they really aren’t needed (according to the code, basically, selections by PK and FK seem to be everywhere). There is no try\catch for the get block, although it may spit here DoesNotExists (kwargs['inviter'] = User.objects.get(id=data['inviter']))
In general, a lot of jambs.
In general, it is difficult to judge what level you are by such a code, since in principle there is nothing specific there, even those who do not know django will write such a google for a couple of days / hours.
I advise you to familiarize yourself with pep8 in more detail + install pep8 and / or pylint for yourself, read at least two scoops of django, practice writing tests, learn selenium. No offense, but for now I would not take you to the middle, as a lot would have to be explained and changed for you.

S
some1else, 2015-12-18
@some1else

I just pierced the files, and most of them are empty blank files, apparently when generating applications with a helper, as in the tutorial :) A mountain of unnecessary imports in the simplest project/public/views.py. In general, it was no longer interesting to watch ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question